The Macedonian government said eight police and 14 members of an "armed group" were killed after police staged a raid in the northern town of Kumanovo, seeking gunmen from Kosovo it claimed were planning to attack civilian and state targets.
Another 37 officers were wounded in Saturday's pre-dawn raid.
Ivo Kotevski, an Interior Ministry spokesman, told a news conference that the gunmen were led by ethnic Albanian former rebel commanders from Kosovo, which broke away from Serbia in war in 1999.
Kotevski named five leaders of the group, all citizens of Kosovo, as founders of paramilitary cells. He said the group entered Macedonia at the beginning of May to launch attacks on state institutions and hid out in Kumanovo's western neighbourhood, where police found a huge arsenal of weapons.
Kotevski said no civilians were reported killed in the raid, which continued into Sunday. Many had fled, carrying their belongings in bags.
More than 30 people were arrested and some of them were taken before a judge in the capital Skopje.
However some residents in Kumanovo were deeply sceptical of the official version of events.
"Me, like other citizens, we are surprised and no one knows what and why this happened. I know during the war in 2001 we were informed and we have supported these groups that were fighting for the Albanian cause but now it is the contrary," Kumanovo resident Xhelal Ademi told the Reuters news agency.
"The people in this region were guarding their villages to not let anyone infiltrate from outside our villages," Ademi said.
Kotevski said some of the attackers killed wore uniforms with insignia of the disbanded ethnic Albanian Kosovo Liberation Army, or UCK.
Authorities said about a fortnight ago, a group of about 40 people wearing UCK uniforms attacked a police watchtower in Gosince on Macedonia's northern border with Kosovo and briefly captured four Macedonian police officers.
Authorities described that incident as "very serious" and said Macedonia was the "target of a terrorist attack".
The Macedonian government has declared two days of mourning for those killed in the operation. Sporting events and political gatherings have been cancelled.
Kumanovo is an ethnically mixed town located about 40km northeast of the capital Skopje, near the border with Kosovo and Serbia.
This incident came a day after thousands of opposition supporters joined nationwide protests against alleged police brutality.