“I will press to ensure that we fully understand what led to this tragedy, and that we are doing everything we can to ensure that our men and women in uniform are protected as they serve our country so capably and courageously in harm’s way,” he said.

Typically, soldiers not on duty are required to remove the ammunition from their weapons while at American military facilities in Iraq. It was not known why the shooter had a loaded weapon. The base is heavily fortified with blast walls and razor wire.

The killing of Americans by their fellow soldiers has been uncommon in Iraq, but not unheard of.

Most recently, in September 2008, an American soldier was arrested after the shooting deaths of two comrades at their patrol base near Iskandariya, about 25 miles south of Baghdad. The soldiers had been assigned to a unit based at Fort Stewart, Ga. The case is currently in military court.

In June 2005, two officers serving with the New York Army National Guard at a base near Tikrit died after an antipersonnel mine was placed next to a window, and a supply specialist was charged in the deaths. The supply specialist was acquitted in military court last year.

In April 2005, Sgt. Hasan Akbar, of the 101st Airborne Division, was sentenced to death for a grenade attack on fellow soldiers in March 2003 in Kuwait, at the beginning of the American-led war in Iraq.

Sergeant Akbar, who was the first American since the Vietnam era to be prosecuted on charges of murdering a fellow soldier in wartime, was convicted of premeditated murder and attempted premeditated murder after he threw grenades into tents and then opened fired on soldiers. He killed two officers and wounded 14 soldiers at Camp Pennsylvania.

The death toll from Monday’s shooting was the highest for American service members in a single attack since April 10, when a suicide truck bombing killed five near the police headquarters in the northern city of Mosul.