Bugged phones, coup plots and shadowy foreign agents. These are some of the cloak-and-dagger aspects of a scandal that has taken Macedonia by storm and touched the highest levels of government.

Nearly weekly revelations and allegations about wiretapped conversations have spun a web of shock and fascination among ordinary Macedonians, hammering the Balkan country's politics and sharply splitting its society. The affair has triggered warnings from the European Union, which has been weighing Macedonia's membership bid for more than a decade. As debate fills social media, people on both sides separate supporters and opponents into "patriots" or "traitors."

At the heart of the scandal lie allegations by the head of the opposition Social Democrat party, Zoran Zaev, that Prime Minister Nikola Gruevski illegally ordered the wiretapping of 20,000 people. The alleged victims include police, judges, journalists, foreign ambassadors, religious leaders and even the prime minister's own close associates and ministers. Zaev claims the taped conversations reveal corruption at the highest level of government in this country of 2 million people, including alleged vote buying, mismanagement of funds and spurious criminal prosecutions of opponents.

Gruevski, who has been in power since 2006, has angrily rejected the accusations. He accuses Zaev of participating in a coup plot conducted by as yet unnamed foreign spy agencies seeking to overthrow his conservative government. He says it's all an attempt to blackmail him into resigning.

Macedonia, which declared independence from Yugoslavia in 1991, narrowly escaped civil war a decade later when rebels in the ethnic Albanian minority took up arms against the government. While that has been the nation's biggest crisis, the political situation in Macedonia has never been graver than now, said political analyst Albert Musliu, who heads the Association for Democratic Initiatives, a non-governmental organization.

"It seems ridiculous, but I've never seen a deeper political crisis in this country," Musliu said. "This is not only a political, but also a deep ethical crisis because the people have seriously lost their trust. The government and political sentiment could change quickly, but the matter of trust is a process that needs a much longer time to be rebuilt."

Recent revelations have included conversations between two people Zaev identified as Finance Minister Zoran Stvreski and Interior Minister Gordana Jankulovska, complaining about Gruevski's spending management. In the conversation, the two allegedly discuss Gruevski ordering the purchase of 100 paintings for a museum and an outlay of 300-400 million euros ($320-$420 million) on monuments and buildings, even as the police service suffers budget cuts.

Gruevski's party recently accused the Social Democrats of aiming to "ruin the reputation of the state, to seize the power without people's support and to help those who have ordered Macedonia to be pushed to its knees on orders of blackmail from foreign centers."

The European Union has expressed "serious concern." EU Enlargement Commissioner Johannes Hahn recently urged Macedonia's politicians to "engage in constructive dialogue," and called for an investigation into the wiretapping allegations.

Media groups have voiced outrage over reports of wiretapped journalists. And Daniel B. Baer, the U.S. ambassador to the Organization for Security and Cooperation in Europe, or OSCE, expressed concern over "the serious allegations that have called into question the independence of the media and of the judiciary, as well as respect for other basic democratic values."

Police charged Zaev last month with preparing a coup and "violence against representatives of the highest state authorities." He was questioned by an investigative judge and has been banned from leaving the country, although not arrested. On Tuesday, police filed further criminal charges against him on allegations of receiving a bribe of 200,000 euros in 2013 from a local businessman to speed up a real estate purchase in the town where he is mayor. He denies the charges.

Five other people, including a former secret police chief and intelligence service officers, are in custody on espionage charges. A Skopje court has already sentenced one of them to three years in prison for espionage and illegal wire-tapping, following a plea bargain.

"For the first time in the history of independent Macedonia," police have prevented "an attempt to endanger the constitutional order and an undemocratic takeover or violation of the will of the citizens," the Interior Ministry said recently.

Zaev has dismissed the accusations, saying the illegal recordings were leaked to him by "patriots" in the intelligence services. His party has filed lawsuits seeking the prosecution of Gruevski's intelligence officers, including the interior minister, a top intelligence official and other government officials, on grounds of illegally wire-tapping without a court order.

The opposition leader claims most of the country's politicians, including himself, have been subjected to illegal recordings for about four years. Under Macedonian law, wiretaps can be conducted with a court order for a maximum of four months.

Zaev claims Gruevski and his family control Macedonia's justice and police systems by naming judges, influencing court decisions and annulling prosecution charges. He says that control led to the "politically motivated" arrest in 2011 of a former interior minister and fierce government critic.

"We are hostages in our own country, where no justice, no police and no (political) system exist," Zaev said during a recent news conference. "Everything is instructed and orchestrated by a small group, by the family of Nikola Gruevski."

The opposition leader's party has boycotted parliament for nearly a year, ever since accusing the governing coalition of fraud in the April 2014 election. Zaev insists the only solution is for a caretaker government to take over and organize new elections.

But Gruevski says he has no intention of going to the polls three years early. He has accused Zaev of "practically sinking into the mud" and of wanting to drag the country into endless crises.

"If he is losing," Gruevski said recently, "he wants everybody to lose."

The only option for a solution appears to be EU mediation — something that the EU has offered and all sides appear to accept.

"Macedonia has a democratic capacity," Zaev said, "but we need a mediator because both parties have absolutely opposite positions."

.