Origin: the Q Continuum.
Super-race able to change matter to energy and to suspend time, existing in a continuum of the limitless dimensions of the galaxy. A dissident once claimed that his brethren are not omnipotent, but have sacrificed in their evolution their mortality, sense of purpose, desire for change, and capacity for growth.
Despite their advanced nature,the Q at times have practiced capital punishment and life imprisonment, especially to punish those who would leave the Continuum. The issue of suicide, viewed as an interruption of their existence, prompted a civil war between the more liberal and the staid Qs, seen as a series of galaxy-wide supernova bursts in 2372.
One of their kind, dubbed "Q," has several times been an intruder amid human affairs, providing taunts and so-called tests especially for the Starfleet crews of Jean-Luc Picard and Kathryn Janeway. His visits have changed the Q's perception of humanity from that of savages to the tamer "unusual creatures" that in time will not be so limited and will in fact surpass the Q — thanks to the quality of "human compulsion." Humans have twice affected Q affairs: when Janeway decided the suicide issue and helped end the Q civil war.
While visits from the Q are problematic at best, not all are alike. The El-Aurian, Guinan, advised Captain Picard, "Some are almost respectable."
Q's home dimension once tired at last of his meddling with lesser races and stripped him of all power, granting him his choice of a mortal human form, until offering to allow his return after an attempted self-sacrifice.
Q says their foreplay can last for decades. Natives measure time in the billions of solar years, such as 5 billion for the Female Q's age. The Continuum is "way beyond sex," which is why Q searched out a human or other reproducible species to mate with. Even so, he designed a new form of copulation for his wife and they bore a child.