KANDAHAR, Afghanistan - Explosions and gunfire rocked the heart of Kabul on Monday as insurgents wearing suicide vests attacked government buildings and a downtown hotel in the most brazen assault on the Afghan capital since last fall.

Afghan officials said 12 people were killed, including seven attackers. More than 70 others were wounded in nearly five hours of fighting before the Afghan government said it had the situation under control.

The gunfire and chaos sent staff at the Canadian Embassy rushing to a secure part of their compound for safety. There has been no report of any Canadian casualties.

"I was particularly concerned about those Canadian advisers who were helping Afghan government ministries," Ambassador William Crosbie told The Canadian Press. "So far, from what we know, all the Canadians are safe."

Taliban spokesman Zabiullah Mujahid told The Associated Press that 20 armed militants, including some with explosive vests designed for suicide missions, had entered Kabul to target the presidential palace and other government buildings in the centre of Kabul.

Explosions and heavy machine-gun fire rattled the city. Debris was strewn on the streets, which were quickly abandoned by crowds that normally fill the area.

The attack came as members of the cabinet were being sworn in by President Hamid Karzai despite the rejection by parliament of most of his choices. Presidential spokesman Waheed Omar said the ceremony had occurred as scheduled and everybody in the palace was safe.

"As we were conducting the ceremony to swear in the cabinet, a terrorist attack was going in an area of Kabul close to the presidential palace," Karzai told reporters.

After a series of blasts and hours of gunfights outside several ministries and inside a shopping mall, Karzai said security had been restored to the capital. Search operations continued amid reports that more attackers were hiding in the city.

It was the biggest assault on Kabul since Oct. 28 when gunmen with automatic weapons and suicide vests stormed a guest house used by UN staff, killing at least 11 people including three UN workers.

The first blast was heard shortly before 10 a.m. in an area where government buildings are concentrated, including the presidential palace, the central bank and the luxury Serena Hotel, a fortified five-star facility popular with visiting westerners. Fighting continued until mid-afternoon with attacks at four locations in an area of 2.6 square kilometres.

In the first assault, a suicide bomber detonated his explosives at Pashtunistan Square, a major intersection near the gates to the presidential palace, the Central Bank and the Serena Hotel.

Clashes broke out as other militants fought with Afghan troops, who converged quickly on the scene in pickup trucks and armoured vehicles. Police sealed off the area and helicopters buzzed overhead.

Several attackers then stormed into a nearby shopping mall, prompting a standoff with security forces. Two bombers were killed when their explosives detonated, setting the four-storey building ablaze.

About 11:17 a.m., another suicide attacker drove toward the area in an ambulance but blew himself up after he was challenged at a checkpoint near the Education Ministry.

At about 1 p.m., three other attackers entered another commercial building housing offices and stores, holding off security forces for about two hours before they were killed.

Details were provided by Interior Minister Hanif Atmar at a news conference in Kabul.

The dead included an intelligence agent, two policemen and two civilians, including one child, according to Atmar. He said 71 other people were wounded, including 35 civilians. Most of the injuries were caused by hand grenade attacks hurled by the militants, he said.

In a statement from Ottawa, Foreign Affairs Minister Lawrence Cannon strongly condemned the attack and extended Canada's condolences to the victims.

"These attacks clearly demonstrate the insurgents in Afghanistan have absolutely no regard for the lives of Afghans," Cannon said.

"(They) are determined to prevent Afghans from living in peace and security and the Afghan government from working for its citizens."

Crosbie, who was visiting Kandahar when the incident occurred, said he was not surprised by the insurgent assault.

"We have been expecting further complex attacks," Crosbie said. "They follow a pattern which we have seen in the city."

Kabul, home to about four or five million people, is a bustling city. Security is everywhere, and government buildings in particular are heavily fortified. Still, Taliban insurgents have shown on several occasions they are capable of striking high-profile targets.

Crosbie conceded that "determined" insurgents will manage to get through the ubiquitous checkpoints, but maintained that Afghan forces have prevented many attacks.

"Unless we are really prepared to lock down the city and stop normal life, I don't think they are going to be able to prevent attacks such as this," he said.

Crosbie called Monday's assault "shattering" for its victims, but said Kabul is not a city under siege.

The main targets, he noted, were Afghan government buildings and security forces, as well as Westerners.

"The insurgents will use instruments of terror to cause terror in the city without real impact on the military situation, but trying to have an impact on the psychology of Afghans," Crosbie said.

Like many others in the city, Afghan-Canadian cardiologist Dr. Asmat Naebkhil spent much of the day following news of the fighting via the radio. He called the situation depressingly common.

"When people sort of see a light in this dark future tunnel, something happens to drown their hopes again in sadness and hopelessness," Naebkhil said.

"The losers in this imperialistic and terrorist war are poor, innocent, hungry and tired Afghan civilians."

United Nations Special Representative Kai Eide said the assault in such a busy area showed a "staggering disregard for civilian lives."

- With files from The Associated Press.