Megara as an independant City-State
Early on in its history, Megara was a neighbor of Corinth, another city-state in ancient times. Megara was a dependent territory of Cornith, meaning that they did not posses complete political independence nor complete authority over their geographic area. After several decades, however, Megara fought a successful war with Cornith, subsequently founding Byzantium* and earning its (Megara's) independence as a city-state.
Megara's role in wars
During the Peloponnesian War (431 BC-404 BC), fought between Athens's empire and Sparta's Peloponnesian League, Megara fought with Sparta; Megara was a part of the League at the time. This League was an alliance in the Peloponnese area, dominated by Sparta, which was, by the end of the 7th century BC, the most powerful state in all of the Peloponnese. Sparta had acquired this position buy gaining other powerful states as allies. For, example, by assisting the city of Elis in controlling the Olympic games, they won their support. By having so much power, Sparta could lead the Peloponnesian League by mere might, rather than having to using direct military force.
Peloponnesia
Government in Megara
Megara's government was based on a democratic system, very similar the Athenian government. In a democracy, all citizens have a say, usually in the form of a vote, as to what laws or policies would affect their lives. In both Athens and Megara, a direct democracy was prevalent. In a direct democracy, citizens did not vote for individuals who represented them and then voted for laws on their behalf, but instead voted on issues personally, as individuals; Megara was famous for the freedom its citizens enjoyed.
*Byzantium was later rebuilt as the Roman capital of Constaninople. Read more about it: http://en.wikipedia.org/wiki/Byzantium