By the summer of 1829, the Peloponnese, parts of Central Greece and several islands had been liberated by Greek revolutionary forces. A peace treaty between the Sublime Porte and the revolutionaries was imminent but it became apparent that the soon to be created Greek state would be limited to whatever lands had been liberated during the war. In August, Aslan Bey and Osman Aga set off from Athens with a force of 7,000 men to fight the Russians in Thrace.
The Greek Army under Dimitrios Ypsilantis (a tactical, organized force by now) awaited them at Petra, a town at a narrow passage in Boeotia between Livadeia and Thebes. On September 12, 1829 the two armies engaged in battle. The Greeks, after a hail of gunfire, charged with swords and drove the Ottoman army into a disorderly retreat. The rest of the Ottoman army, now in danger of being surrounded, also retreated. For both sides the casualties were relatively light. The Greeks suffered 3 dead and 12 wounded, the Ottomans about hundred dead.
In order to follow his orders to march into Thrace, Osman Aga signed a truce the following day with the Greeks. According to the truce, the Ottomans would surrender all lands from Livadeia to the Spercheios River in exchange for safe passage out of Central Greece. This battle was significant as it was the first time the Greeks had fought victoriously as a regular army. It also marked the first time that Ottoman Empire and Greeks had negotiated on the field of battle. The battle of Petra was the last of the Greek War of Independence. Dimitrios Ypsilantis ended the war started by his brother, Alexandros Ypsilantis, when he crossed the Prut River eight and a half years earlier.