Kosovo's parliament chose a new president in the first minutes of Wednesday, beating a constitutional deadline that would otherwise have dissolved the legislature and sent the country to the polls yet again.

Lawmakers elected Justina Shiroka Pula, an economist and head of the Kosovo Academy of Sciences and Arts, with 81 votes in the 120-seat assembly, one more than the two-thirds threshold of 80. According to RFE/RL, the secret ballot began just six minutes before midnight and wasn't finished until 12 minutes after, which some experts said could open the door to a legal challenge, though none had been announced.

How the deal came together

The vote ended a day of deadlock between Prime Minister Albin Kurti's ruling Vetevendosje party and the opposition Democratic Party of Kosovo (PDK). The PDK insisted that parliament first pass changes to the law governing the Kosovo Specialist Chambers, the Hague-based court that tries former Kosovo Liberation Army (KLA) leaders for alleged war crimes. Kurti initially wanted the order reversed. The breakthrough, RFE/RL reported, came with his third offer: nominating Shiroka Pula, a former PDK member, and holding the court vote first.

The court amendments passed with 88 votes. They narrow the court's jurisdiction, cap sentences at 15 years, require them to be served in Kosovo and make people with final convictions eligible for presidential pardons. RFE/RL noted that legal experts have warned the changes could face constitutional review and that Kosovo must respect its international commitments.

The push followed the Sept. 16 convictions of four former KLA leaders, including former President Hashim Thaçi, who received 25 years. Weeks of protests followed; on Oct. 5, police used tear gas and water cannons near parliament, and six officers were injured, according to RFE/RL.

Who she is

Shiroka Pula, 73, is Kosovo's third woman president, after Atifete Jahjaga and Vjosa Osmani, Al Jazeera reported. A longtime University of Pristina economics professor, she became the first woman to lead the national academy last December. She also served as minister of energy and mining from 2008 to 2011 and as a PDK lawmaker from 2011 to 2014. "I will be the president of all citizens," she said after the vote, according to Reuters.

The presidency is largely ceremonial, but it has repeatedly been a source of instability because of the two-thirds requirement. Failure to elect a president triggered snap elections in June, Reuters noted. Donika Emini, a research fellow at the University of Graz, told Al Jazeera the outcome was "a politically necessary compromise to restore institutional functioning," but not proof that Kosovo's deep polarization has been resolved.