Macedonia's parliament has named a special prosecutor to investigate claims that the conservative government allegedly ordered a massive wiretapping operation, in a scandal that has plunged the Balkan country into political crisis.

Lawmakers backed the appointment of public prosecutor Katica Janeva for the post in a vote late Tuesday, following an agreement between the country's four main political parties.

The appointed is key part of a European Union-brokered deal to try and defuse the crisis. Under that agreement, Prime Minister Nikola Gruevski will also hand over power to a caretaker government next January for an early general election in April.

The opposition Social Democrats claim the government ordered the illegal wiretaps of 20,000 people, including police officials, judges, religious leaders, journalists and foreign diplomats.

Gruevski has denied any wrongdoing.