Thailand’s parliament will meet next week to select a new prime minister after a court ruling cleared a legal hurdle that had held up the selection process for nearly a month.

A joint session of the elected House of Representatives and the military-appointed Senate will be held on Aug. 22, parliament speaker Wan Muhamad Noor Matha told reporters on Wednesday. It will be the second vote to select a prime minister since the May 14 general election that saw the defeat of pro-royalist and military-backed parties.

The announcement of the new schedule came after the constitutional court dismissed a petition challenging a parliament decision last month to deny pro-democracy leader Pita Limjaroenrat a second shot at the prime minister’s job. The nine-member court unanimously rejected the plea, saying the plaintiffs were not eligible to challenge the parliament move as their rights were not directly violated.