TEHRAN – Iran, stung by European Union criticism of its handling of post-election unrest, on Wednesday accused the 27-nation bloc of meddling and demanded an apology before any more talks on Tehran's disputed nuclear program.

Iran's top military commander laid down the condition amid continued recriminations over the June 12 presidential election that returned hard-liner Mahmoud Ahmadinejad to power, beating rivals who insist the vote was rigged in his favor.

Because of the interference of this (EU) group in the post-election riots ... they have lost their qualification to hold nuclear talks with Iran, Major-General Hassan Firouzabadi was quoted as saying by the semi-official Fars news agency.

Three EU powers, Britain, France and Germany, have led negotiations with Iran over nuclear work which the West suspects is aimed at bomb-making. Tehran says it is wholly peaceful.

Before apologizing for their huge mistake ... they have no right to talk about nuclear negotiations, Firouzabadi said.

Together with the United States, Russia and China, the EU nations have offered a package of economic and other incentives to Iran if it will stop enriching uranium, a process that can produce fuel for power plants, or, potentially, a nuclear bomb.

Iran has rejected the demand, saying it has the right to pursue such work as a member of the Non-Proliferation Treaty.

U.S. President Barack Obama's administration had offered to join the negotiations, but the turmoil after the election has dimmed prospects for any American engagement with Tehran.

Iranian hardliners, consolidating their grip after security forces suppressed huge street protests, have blamed foreign powers for the unrest, the gravest since the 1979 Islamic revolution.

Iran and Britain exchanged more hostile words about the post-election protests, with the Fars agency alleging that an Iranian employee at the British embassy had helped foment them.

The authorities detained nine Iranian employees at the British embassy on Sunday, but most have been freed.

REMARKABLE ROLE

Among the three detained British embassy staff there was one who ... had a remarkable role during the recent unrest in managing it behind the scenes, Fars said, citing no source.

It said another staffer, who had been a main element behind the riots, was freed because she had diplomatic immunity.

British Foreign Secretary David Miliband told Ireland's RTE radio he believed two embassy employees were still held, describing the detentions and the previous expulsion of two British diplomats as completely contrary to the sort of good political engagement that Iran says that it wants.

He said the violence the Iranian government had perpetrated against its people since the election was shocking. In the modern world, the truth will out and I hope that it comes out before too many more bones are broken and lives lost in Iran.

Swedish Foreign Minister Carl Bildt said Iran and the EU shared an interest in protecting diplomatic staff.

Asked whether there was a recommendation for EU countries to withdraw ambassadors from Tehran, he told Reuters: We are taking one step at a time. At the moment we are in a state of dialogue with the Iranian authorities about these issues.

Bildt, speaking in Stockholm on the sidelines of a meeting at the start of Sweden's six-month EU presidency, said EU nations must act to protect Iranian diplomatic missions, while the Iranians have to ensure that staff at the European embassies are not subject to harassment by the authorities.

Ahmadinejad canceled a trip to Libya for an African Union summit that would have given him another chance to burnish his image at a potentially friendly international forum.

His office gave no reason for the decision but a Foreign Ministry spokesman later said Ahmadinejad was too busy to go.

In a show of confidence, Ahmadinejad attended a regional summit in Russia four days after the election, ignoring mass street protests by supporters of losing candidates Mirhossein Mousavi and Mehdi Karoubi, who both say the vote was fraudulent.

Karoubi, a reformist who came last in the poll, again rejected the result and pledged to fight on. I don't consider this government legitimate, a statement on his website said.

The Guardian Council, a supervisory body, on Monday endorsed the election result and dismissed complaints of irregularities.

Karoubi and Mousavi, a moderate former prime minister, have stuck by their demands for the vote to be annulled, in defiance of Supreme Leader Ayatollah Ali Khamenei, who has upheld the result and denounced dissenters. Khamenei's word is final.

Some visible and invisible forces blocked any change in the executive power, Karoubi complained, demanding the release of thousands of people he said had been arrested during the unrest.

Iran's police chief, Ismail Ahmadi-Moghaddam, put the total number of detainees at 1,032 and said most had been freed. The rest had been referred to the public and revolutionary courts in Tehran, Fars agency quoted him as saying. He said 20 rioters had been killed and more than 500 police injured.

(Writing by Alistair Lyon, editing by Mark Trevelyan)