The afternoon raid on the provincial police base in Kandahar appeared to be an effort to undercut NATO assertions that the security situation had improved since last year's influx of U.S. and Afghan troops into Kandahar province, the Taliban's birthplace.
The Islamic militant movement claimed responsibility for the attack, which came amid American-backed efforts to train Afghan forces so that they can take responsibility for national security by a 2014 deadline.
Fifteen of at least 18 people killed were Afghan police officers, said Zalmai Ayubi, spokesman for provincial governor of Kandahar. Interior Ministry spokesman Zemeri Bashary in Kabul said 21 people were killed, including three Afghan soldiers, two civilians and one intelligence agent, and that 49 people were wounded.
Both officials said five suicide bombers also died. Ayubi said a sixth attacker was taken into custody.
Taliban spokesman Qari Yousef Ahmadi said in a telephone interview with The Associated Press that the group had deployed six suicide bombers in Kandahar on Saturday.
Insurgents struck around noon, detonating explosives near the police headquarters in central Kandahar. The compound is close to the governor's office.
Initial reports indicated a car bomb exploded outside the headquarters, and two suicide bombers then tried to storm inside but blew themselves up outside the perimeter wall, according to NATO officials in Kandahar.
Other attackers occupied a multistory building housing a wedding hall across the street from the police compound. From there, they opened fired.
"I was going to my shop just behind the police headquarters when the first blast occurred. I stopped, and after a minute or two, guns started firing," said witness Abdul Kadeer Ahmed. "We could see that people at the wedding hall were firing toward the police headquarters."
He said police were firing "everywhere."
Residents shuttered shops and took cover as the fighting raged. Helicopters hovered over the city and police deployed extra forces on the streets and around government buildings.
Associated Press reporters near the fighting said explosions and gunfire rocked the neighborhood for more than three hours.
A car bomb that detonated after the initial attack appeared designed to target police and rescuers coming to the aid of victims, NATO said.
Afghan President Hamid Karzai said the attack was aimed at disrupting the peace process, a reference to his government's efforts to reconcile with top Taliban leaders - even though no official negotiations are underway.
"This inhumane act by the Taliban demonstrates the brutality of terrorism and their complete disregard for human life," U.S. Ambassador Karl W. Eikenberry said in a statement.
There are now 1,600 Afghan policemen in Kandahar - twice as many as last year - working to protect the city alongside a beefed-up, U.S.-led NATO presence throughout the province.
But insurgents continue to attack officials and others who support pro-government forces. Late last month, a suicide bomber killed the province's deputy governor.
On Monday, a suicide bomber killed a retired U.S. Customs and Border Protection officer and wounded three other American customs workers when he detonated explosives inside a warehouse compound during a visit by NATO forces.
Photojournalist Giles Duley was critically wounded on Feb. 7 when he was struck by a roadside bomb while embedded with U.S. troops in Kandahar province, the London-based photo agency Camera Press said Saturday.
The agency said Duley, 39, underwent emergency surgery in Afghanistan and additional surgery in Britain after losing parts of limbs.
U.S. and NATO commanders insist they are making progress in the fight against the Taliban and its allies. The U.S. hopes to solidify gains against insurgents as it prepares to begin drawing down forces in July.
Schreck reported from Kabul. Associated Press writers Rahim Faiez and Deb Riechmann in Kabul and Kathy Gannon in Kandahar contributed to this report.