BANGKOK — Thailand’s opposition Pheu Thai Party won the most seats in the country’s first election since a 2014 coup, but despite an alliance with other pro-democracy parties it likely will not be able to form a government because of rules that help the military.

No party holds a majority of seats in the House of Representatives, according to official results released Wednesday, meaning selecting a prime minister could involve prolonged negotiations. But the head of the junta and leader of the 2014 coup, Prayuth Chan-ocha, is expected to retain his post as prime minister.

“This is what the election was designed for,” said Pavin Chachavalpongpun, an associate professor of political science at the Center for Southeast Asian Studies at Kyoto University. “The election was designed for the prolongation of military rule.”

The military, which wrote the 2017 constitution that created the framework for the new government, appoints the 250-member Senate, giving it a built-in advantage before voting even began for the 500-member House of Representatives in March.