Charles XII then turned south to meet Augustus II, Elector of Saxony, King of Poland and Grand Duke of Lithuania. The Polish-Lithuanian Commonwealth was formally neutral at this point, as Augustus started the war as an Elector of Saxony. Disregarding Polish negotiation proposals supported by the Swedish parliament, Charles crossed into the Commonwealth and decisively defeated the Saxe-Polish forces in the Battle of Klissow in 1702 and in the Battle of Pultusk in 1703. This successful invasion enabled Charles XII to dethrone Augustus II and coerce the Polish sejm to replace him with Stanisław I Leszczyński in 1704.:694 August II resisted, still possessing control of his native Saxony, but was decisively defeated at the Battle of Fraustadt in 1706, a battle sometimes compared to the Ancient Battle of Cannae due to the Swedish forces' use of double envelopment, with a deadly result for the Saxon army. August II was forced to sign the Treaty of Altranstädt in 1706 in which he made peace with the Swedish Empire,:701 renounced his claims to the Polish crown, accepted Stanisław Leszczyński as king, and ended his alliance with Russia. Patkul was also extradited and executed by breaking on the wheel in 1707, an incident which, given his diplomatic immunity, infuriated opinion against the Swedish king, who was then expected to win the war against the only hostile power remaining, Tsar Peter's Russia.
Question: Did the Treaty of Altranstädt occur before or after Augustus II was dethroned?
Answer: after