American troops — backed by attack helicopters — then fanned out through the city to hunt down the attackers in clashes that lasted into the late afternoon. Tanks deployed in the streets; smoke rose above a mosque.
The violence also killed three civilians, medical officials said. As many as 44 people were wounded, including 20 American soldiers and four Iraqi guardsmen, the military and hospital officials said.
Also Thursday, the Philippines prohibited its citizens from traveling to Iraq to work after militants released a videotape threatening to kill a Filipino hostage if the country did not withdraw its troops.
About 10:30 a.m. Thursday, Iraqi insurgents lashed out at U.S. forces in Samarra, a hotbed of anti-coalition resistance 60 miles north of Baghdad, said Maj. Neal O'Brien, the spokesman for the 1st Infantry Division.
One witness, Khalid Salih, said the gate of the headquarters building shared by U.S. forces and their Iraqi national guard allies was open when a sport utility vehicle rigged with a bomb drove in.
"I saw a GMC enter the base and immediately explode," he said.
Insurgents then launched 38 mortars at the headquarters, destroying the building, O'Brien said. Some of the rounds landed in nearby residential neighborhoods.
About 25 minutes after the mortar attack — once radar determined where it had originated — U.S. soldiers responded with four mortar rounds of their own.
In other developments:
American troops moved through the streets to flush out the insurgents, and four fighters shot at the soldiers before taking refuge in a building, O'Brien said. U.S. helicopters swooped in and attacked with Hellfire missiles, killing the four attackers.
Helicopter gunships were also used in Samarra about a week before the United States handed over power to Iraq's interim government on June 28. The city is part of the so-called Sunni Triangle, where support for Saddam Hussein's fallen regime had been strong.
Iraqi insurgents in the area often launch mortar and rocket attacks on U.S. bases. One rocket attack last month on a logistics base near Balad killed three U.S. soldiers and wounded 25 people.
Before the attack Thursday, a U.S. military convoy in Samarra was targeted by a roadside bomb that wounded one U.S. soldier, O'Brien said.
Late Thursday, four large explosions were heard at an Iraqi base in the town of Mishahda, 25 miles north of Baghdad. Volleys of gunfire broke out immediately afterward. U.S. military officials had no immediate comment.
In another attack, gunmen along the road from Samarra to Balad strafed a truck, killing two Turkish drivers and causing the vehicle to flip over, witnesses said. Insurgents have taken many truck drivers hostage in an effort to spread fear and disrupt supplies for U.S. forces.
Meanwhile, an explosion killed former senior Baath party official, Ali Abbas Hassan, as he left his textile factory in Baghdad, said police Lt. Anmar Yassin. Authorities didn't know the cause of the explosion.
Explosions were also heard in Fallujah, the Sunni city considered a haven for militants seeking to attack U.S. and Iraqi forces. Several airstrikes have been launched at suspected safehouses believed linked to Jordanian militant Abu Musab al-Zarqawi.
Early Friday, the Al-Jazeera television network broadcast a video showing Zarqawi's Tawhid and Jihad group threatening to execute two Bulgarian hostages if the U.S. military did not release all Iraqi detainees within 24 hours.
The video showed the two unidentified Bulgarians sitting with their hands cuffed, flanked by three masked, armed men. The group had previously claimed responsibility for the beheading of U.S. businessman Nicholas Berg and South Korean translator Kim Sun-il.
The violence came in the wake of the government's announcement Wednesday of new emergency laws giving it broad powers to fight the enduring insurgency.
Americans make up most of the nearly 160,000 foreign troops here, but they have been gradually handing over security responsibilities to Iraqi security forces — and working closely with them. Iraqi troops lack the equipment and training to handle the task of crushing the insurgency.
The 51 Filipino troops in Iraq are a fraction of the foreign troops here, but more than 4,000 Filipino civilians serve food, clean toilets and form the backbone of the support staff for American forces. The U.S. military would be hard-pressed to operate in Iraq without the Filipinos.
Word of the capture of a Filipino hostage — and the insurgents' threat to kill him — heaped pressure on Philippine President Gloria Macapagal Arroyo, who decided Thursday to bar more contract workers from traveling to Iraq.
She announced no decision on whether to extend the deployment of her country's troops past their scheduled departure date this month.
The hostage was shown surrounded by armed, masked men on a video broadcast by Al-Jazeera on Wednesday. The hostage wore a bright orange jumpsuit like that worn by American hostage Nicholas Berg and South Korean hostage Kim Sun-il when they were beheaded by Iraqi militants led by al-Zarqawi.
ABS-CBN TV, quoting the Philippine ambassador in Qatar, identified the hostage as Angelo dela Cruz, a truck driver who had crossed into Iraq from Saudi Arabia.