"As the right of each sentient species to live in accordance with its normal cultural evolution is considered sacred, no Star Fleet personnel may interfere with the healthy development of alien life and culture. Such interference includes the introduction of superior knowledge, strength, or technology to a world whose society is incapable of handling such advantages wisely. Star Fleet personnel may not violate this Prime Directive, even to save their lives and/or their ship unless they are acting to right an earlier violation or an accidental contamination of said culture. This directive takes precedence over any and all other considerations, and carries with it the highest moral obligation."
In general, the Prime Directive forbids Starfleet from interfering in the politics of other cultures; when interacting with cultures that are unaware of alien life and/or have not yet developed interstellar space flight, it forbids Starfleet personnel from even revealing their true nature and origins.
The origin of the Prime Directive may lie with the Vulcans; even before the founding of the Federation, their policy was to avoid contact with other civilizations that had not yet developed warp drive technology.
In TOS, the Prime Directive was described as the "highest law" but was treated more like a loose guideline that was subject to the Captain's discretion, and Kirk was known to throw it out the window on more than one occasion. In TNG, the interpretation is theoretically at least as strict, but Picard still disregarded it on more than one occasion without serious repercussions.
The first time we saw any serious consequence for a violation of the Prime Directive was in Star Trek Into Darkness, in which Kirk was reprimanded and demoted for interfering in a planet's cultural development.
- "The Prime Directive serves many purposes, not the least of which is to protect us. It keeps us from allowing our emotions to overrule our judgement."
- --Captain Picard, TNG "Pen Pals"
While envisioned as a moral restriction against the kind of cultural domination and exploitation practiced by European nations colonizing Africa, the Americas, Australia, and other regions with less advanced technology, the Prime Directive is widely regarded as excessive in its restrictions on Starfleet intervention. On at least two occasions, strictly following the Prime Directive would have resulted in the extinction of a sentient species; fortunately for the species involved, the Prime Directive was disobeyed in both instances.