The truth is usually just an excuse for lack of imagination.
Garak (played by Andrew Robinson) was Star Trek: Deep Space Nine's own resident anti-hero. He may have lied, cheated, stole from, conned, betrayed, assassinated, or otherwise did not-very-nice things to just about everyone he ever met, but he somehow managed to be just so dang likable doing it.
Garak was a mysterious character in the early seasons of DS9. He was the only Cardassian left on the station after the Cardassians handed over Terok Nor (their name for the station) to the United Federation of Planets. Due to his secretive nature and animosity between the Cardassian Union and the Federation, he was originally viewed with suspicion. Many thought he was left behind as a spy, using his tailor shop on the Promenade as cover. Others believed he was exiled from Cardassia for some unknown reason. As a result, he lived a very lonely life on the station until Doctor Julian Bashir befriended him.
Although Bashir and Garak had frequent lunches and long conversations, Garak somehow managed to only reveal bits and snippets of his past to his friend, and many of the ones he did let slip were of suspect veracity. He often lied, exaggerated, understated, or misled Bashir with half-truths, although he would claim that everything he said was true, "especially the lies." He seemed to particularly enjoy telling clearly skeptical people that he was nothing more than a simple tailor.
Slowly, it became clear that Garak was indeed an exile from Cardassia, rather than a spy. Although he loved his home planet with all his heart, he was upset and disillusioned with its government and the ones who were running it, particularly Gul Dukat, who hated Garak for a number of personal and political reasons. Garak's familiarity with high levels of Cardassian government and military came in handy for the Federation several times in dealing with the Cardassians, and it was eventually discovered that he was a former member of the Cardassian secret intelligence organization the Obsidian Order. The Obsidian Order is comparable to the Federation's Section 31 or the Romulan Tal Shiar, as none of them officially exist, and all of them use questionable or "black ops" tactics to preserve their governments.
As a member of the Obsidian Order, Garak had a brain implant installed that would release endorphins on command, to make him resistant to interrogation by torture. Unfortunately for Garak, being exiled to Deep Space Nine was a kind of torture for him and he had left it engaged for two straight years before it began to malfunction. Bashir was able to save his life, but had to remove the implant to do it. In his weakness while wracked with pain, Garak babbled out several contradictory reasons for his exile to Bashir.
Garak's usefulness to the Federation came to the forefront during the Dominion War, because his former association with the Obsidian Order left him with knowledge of secret Cardassian codes and a few high-level connections on Cardassia, some of whom he could even trust. Key moments include:
Participating in a joint Obsidian Order / Tal Shiar surprise attack on what they thought was the Founder's homeworld (although this was actually an ambush by the Jem'Hadar that wiped out the fleet, Garak just barely surviving).
Overcoming his claustrophobia to work in a tight space to activate a transporter, rescuing several prisoners from a Dominion internment camp.
Joining the crew of the USS Defiant after the Cardassians temporarily re-took the Deep Space Nine station.
Participating in the sabotage of a Ketracel White factory, and discovering that Cardassians, unlike humans, can use the Dominion ship headsets for prolonged periods of time without suffering intense headaches.
Helping Captain Benjamin Sisko create a forged holographic video to convince the Romulans that the Dominion had immediate plans to attack the Romulan Star Empire (and then killing both the forger and the Romulan senator who detected the forgery, covering his tracks and making the assassination look like a Dominion cover-up). This brought the Romulans into the Dominion War on the side of the Federation.
Cracking Cardassian encryption so the Federation could read intercepted secret Cardassian transmissions (which nearly drove him insane by the thought of betraying his people, bearing responsibility for Cardassian deaths).
Garak's personal life was no less complicated. His father was distant, and for political reasons, due to also being in the Obsidian Order, he was unable to acknowledge Garak as his son for many years. He met and fell in love with Gul Dukat's half-Bajoran daughter, Tora Ziyal, during the Dominion War, but lost her as well when she was killed by Damar as a traitor when she refused to join the Cardassian evacuation of Terok Nor.
Garak's life was constantly underscored by tragedy, betrayed and exiled by the secret order that made him what he was, trapped within secrets and loneliness while surrounded by enemies, forced into betraying his own people to save them, and finally ending his exile by freeing Cardassia from Dominion occupation only to find it all but destroyed by the Jem'Hadar. Garak was last seen back on what was left of his beloved homeworld.
In fan fiction, Garak is frequently seen to be the "top" in a sado-masochistic homosexual relationship with Bashir, because straight men aren't allowed to be close friends.