Megara is an ancient city (pop. 23,032 in 2001) in Attica
Attica is a historical region of Greece, containing Athens, the current capital of Greece. The historical region is centered on the Attic peninsula, which projects into the Aegean Sea...

, Greece
Greece , officially the Hellenic Republic , and historically Hellas or the Republic of Greece in English, is a country in southeastern Europe....

. It lies in the northern section of the Isthmus of Corinth
Isthmus of Corinth
The Isthmus of Corinth is the narrow land bridge which connects the Peloponnese peninsula with the rest of the mainland of Greece, near the city of Corinth. The word "isthmus" comes from the Ancient Greek word for "neck" and refers to the narrowness of the land. The Isthmus was known in the ancient...

 opposite the island of Salamis
Salamis Island
Salamis , is the largest Greek island in the Saronic Gulf, about 1 nautical mile off-coast from Piraeus and about 16 km west of Athens. The chief city, Salamina , lies in the west-facing core of the crescent on Salamis Bay, which opens into the Saronic Gulf...

, which belonged to Megara in archaic times, before being taken by Athens
Athens , is the capital and largest city of Greece. Athens dominates the Attica region and is one of the world's oldest cities, as its recorded history spans around 3,400 years. Classical Athens was a powerful city-state...

. Megara was one of the four districts of Attica, embodied in the four mythic sons of King Pandion II
Pandion II
In Greek mythology, Pandion II was son and heir of Cecrops II, King of Athens. and his wife Metiadusa. He was exiled from Athens by the sons of his uncle Metion who sought to put Metion on the throne. Pandion fled to Megara where he married Pylia, daughter of King Pylas. Later, Pylas went into...

, of whom Nisos
In Greek mythology, Nisos was the King of Megara, and one of the four sons of Pandion II, King of Athens.He was married to Abrota, sister of Megareus, and when she died, Nisos commanded that the Megarian women wear clothes like she had. His daughter Eurynome, with Poseidon, had the famous son...

 was the ruler of Megara. Megara was also a trade port, its people using their ships and wealth as a way to gain leverage on armies of neighboring poleis.