On June 17, 1696, King John III Sobieski died in his palace at Wilanów near Warsaw, which meant that another free election was necessary, as the Polish–Lithuanian Commonwealth was left without a monarch.
The mother and her son argued about properties of John III Sobieski, and as a result, James Louis lost the support of Polish nobility.
The Russians backed Augustus, who had previously declared that he would continue the war, and who had in 1695–1696 commanded Austrian - Saxon army in its Hungarian campaign.
Third candidate, James Louis Sobieski, expressed his support of Conti.On July 27, 1697, Augustus, backed by Russia, Austria and Brandenburg-Prussia, crossed Polish border near Czeladź in Lesser Poland.
On September 15, 1697, Augustus signed the Pacta Conventa, and was crowned new King of Poland, August II, by Bishop of Kujawy, Stanisław Dąmbski.
The situation was solved without foreign intervention, as on November 9, the attack of troops loyal to Augustus forced Conti to abandon his quarters in Oliwa, and to leave Poland.
Primate Radziejowski refused to recognize Augustus until spring of 1698, when he received a large sum of money, and was promised a government post.