Once the revolt against Ottomans broke out, first in Vlahia and Moldavia and then in Peloponnese, Mainland Greece and the islands, Athens and Attica also took part to the movement. A few hundreds of Ottomans took some hostages and were covered in the walls of Acropolis, whereas some families among the residents took refuge in Salamina.
The Ottomans were besieged by the Greeks from May until August of 1821, when Omer Vryoni attacked them and achieved to provide food, weapons and water to the besieged. After he left, the siege kept on, which resulted to the surrender of the Ottomans, as they totally lacked water. So, they left Acropolis and departed for Turkey on the 21st of June 1822, taking along all their goods and weapons. However, a few days before they left a few murders of Ottomans took place, as Greeks were informed that the Ottoman fleet was on its way to Athens. Once the Ottomans had left, the domination of Athens was taken by Odysseus Androutsos, an excellent veteran warrior who leaded a corps of 150 men.
Following the old tradition stating that a spring with potable water existed since ancient times on the rock of the Acropolis, the Greeks, under the instructions of the archaeologist Kyriakos Pittakis, searched for it and found the ancient spring of Klepsydra which was cleaned and protected. They also supplied the place with abundant food and ammunitions, in order to be ready in case of siege.
Attica lived in relative calmness until 1825 when the Greek started to fight each other. Androutsos was involved in conflicts with other chieftains whereas he was told to oppress the villages. Finally, on the 5th of June 1825, he was jailed by Giannis Gouras and soon after he was found dead under the walls of Acropolis. According to several suggestions, Androutsos had been killed by Gouras and thrown over the walls, so that his death would appear as an accident.
Meantime, the independence war was at its last gasp, as the Egyptian army, well trained and equipped by French officers, under the commands of Ibrahim Pasha, had taken back the entire Peloponnese except for two or three castles. So, it was only Athens and the area around that were still dominated by Greeks. During the summer of 1823, the Ottoman army commanded by the veteran Koutahis (Mehmet Reshid Pasha) and Omer Vrioni reached Athens. Gouras withdrew in Acropolis and the defense of the badly fortified lower town was led by Makrygiannis, who achieved to resist the Ottomans for about a month; however, in August, as the pressure of the Ottoman army was too hard he, too, was forced to trench himself into Acropolis.
Facing this situation, the Greek government, wishing to save Acropolis, but also its reputation, had sent to Athens 3.000 well armed men under the French philhellene Favier and the excellent Greek warrior Georgios Karaiskakis. Meanwhile Gouras had been killed and the situation grew harder and harder. Several battles had then took place both around the Acropolis and in the lower town, without any significant result, as neither the Ottomans would end the siege, nor the Greeks would surrender. However, the Greek troops achieved to break the siege and bring food and arms to the corps besieged in Acropolis. However, as situation was almost insupportable, Makrygiannis, leading only a few men, achieved to break the siege and notify the government, then sitting in Aegina, how things were going. At the same time Favier, leading 650 men, achieved to reach Acropolis in December 1826; but, as he was betrayed, they had to retreat in Acropolis too.
In February 1827 the British navy officer Abney Hastinngs reached Piraeus with his steamship “Karteria” and six smaller vessels, accompanied by George Finlay and Samuel Howe, in order to prepare a final effort to break the siege of Acropolis. The first attempts had completely failed and many Greek warriors were killed. In March, the British general Richard Church and the admiral Lord Cochrane, appointed by the Greek government in head of the Greek army and navy respectively, reached Athens. The British had cooperated with Karaiskakis who was pretty disappointed for the appointment of foreigners as heads of the Greek army. Due to wrong calculations of the situation by the philhellene Gordon, the Greek troops were totally defeated.
Apart from that, the Greeks had suffered the loss of Karaiskakis who was severely wounded in one of the battles and died in Salamina. The last attempt to break the siege and conquer Athens had resulted to the final defeat of the Greeks. The besieged were forced to leave Acropolis to the forces of Kioutahis on the 27th of May 1827 and take refuge to Salamina where they arrived by French and Austrian ships.
After that, Acropolis and the rest of Attica remained in the hands of the Ottomans until Greece gained its independence in 1832, a fact that had followed the defeat of the Ottoman fleet at Navarino by the united fleets of Britain, France and Russia in October 1827, but also the defeat of the Ottomans by the Russians in 1829. The independence of Greece signaled the return of the Athenian refugees back to their home town. Thus, when Otto, the Bavarian prince who was elected by the Great Powers as king of Greece, arrived at Nauplio in 1832, Athens already counted a few thousands of residents. However, Acropolis was still in the hands of the Ottomans and remained so until the 31st of March 1833 when the Ottoman provost marshal yielded Acropolis to the young Bavarian captain Christophoros Nezer, following the decision of Otto to make Athens the capital city of his kingdom. Ever since, Athens continued its life as the capital city of the Greek state.