The shooting occurred at Camp Liberty, a sprawling U.S. base on the western edge of Baghdad near the city's international airport and adjacent to another facility where President Barack Obama visited last month.
White House spokesman Robert Gibbs called the shooting a "terrible tragedy" and said Obama planned to meet with Defense Secretary Gates later in the day to discuss the matter. Gibbs said the president's heart goes out to the victims' families and wants to know what happened.
A brief U.S. statement said the soldier "suspected of being involved with the shooting" was in custody but gave no further details. A senior military official in Washington said three others were wounded, but the U.S. military in Baghdad said nobody else was hurt.
In Washington, Pentagon officials said the shooting happened at a stress clinic, where troops can go for help with the stresses of combat or personal issues. It was unclear whether those killed were workers at the clinic or were there for counseling. No details were released about the gunman or what might have provoked the shooting.
"Anytime we lose one of our own, it affects us all," U.S. military spokesman Col. John Robinson said in Baghdad. "Our hearts go out to the families and friends of all the service members involved in this terrible tragedy."
Separately, the military announced Monday that a U.S. soldier was also killed a day earlier when a roadside bomb exploded near his vehicle in Basra province of southern Baghdad.
The death toll from the Monday shooting was the highest for U.S. personnel in a single attack since April 10, when a suicide truck driver killed five American soldiers with a blast near a police headquarters in Mosul.
Attacks on officers and sergeants, known as fraggings, were not uncommon during the Vietnam war as morale in the ranks sank. However, such attacks are believed to be rare in the wars in Iraq and Afghanistan.
In 2005, Army Sgt. Hasan Akbar was sentenced to death for killing two officers in Kuwait just before the U.S.-led invasion of Iraq in 2003.
In June 2005, an Army captain and lieutenant were killed when an anti-personnel mine detonated in the window of their room at the U.S. base in Tikrit. National Guard Staff Sgt. Alberto Martinez was acquitted in the blast.
Additionally, there have been several incidents recently when gunmen dressed as Iraqi soldiers have opened fire on American troops, including an attack in the northern city of Mosul on May 2 when two soldiers and the gunman were killed.
Also Monday, a senior Iraqi traffic officer was assassinated on his way to work in Baghdad. It was the second attack on a high-ranking traffic police officer in the capital in as many days.
A car cut off Brig. Gen. Abdul-Hussein al-Kadhoumi as he drove through a central square in the capital and a second vehicle pulled up alongside and riddled him with bullets, police said, citing witnesses. Al-Kadhoumi was director of operations for the traffic authority.
The gunmen were armed with pistols equipped with silencers, the police added on condition of anonymity because they were not authorized to speak to the media.
Incidents involving gunmen armed with sophisticated weapons, including silencers, have been on the rise since a string of high-profile robberies in April.
Associated Press Writer Pauline Jelinek contributed to this report from Washington.
© 2009 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.
A San Diego couple says they are heartbroken after their family pet was attacked by another dog at a park in Allied Gardens over the weekend. The couple's dog is in critical condition and News 8 has learned this isn’t the first incident at the park involving the same dogs.
The City of Santee has formed a new committee to tackle issues stemming from highway 52. Residents say ever since the extension from the 125 to the 67 opened several years ago traffic in the city has gotten steadily worse.
Investigators say 54-year-old Peter Chadwick killed his wife back in 2012 and disappeared while he was free on bond in 2015. Now they're hoping a new reward and podcast series will help lead to his capture.
A pod of whales put on a show at La Jolla Cove. The five orcas came within 30 feet of the lifeguard tower area Wednesday.
Six more women may be victims of sexual assault by a prominent orthopedic surgeon who was featured in a TV reality dating show, and his girlfriend, authorities said Wednesday.
Temperatures continue to cool through Friday, warmer Saturday through the weekend. Humid in the deserts due to tropical moisture surge, decreasing through the weekend.
A judge in Pasadena on Wednesday dismissed 10 felony charges against a so-called "Dine-and-Dash Dater" who was accused of walking out on checks while on first dates with numerous women at Southland restaurants.
A bill giving cities in San Diego County and the county itself the authority to establish a neighborhood electric vehicle transportation plan was signed into law Wednesday by Gov. Jerry Brown.
The 14th annual Mama's Pies Thanksgiving Bake Sale will run from Oct. 8 through Nov. 19 and include two dozen local bakers, it was announced Wednesday.
A group of San Diego-based federal, state and local officials on Wednesday announced their support for Measure G, the SDSU West Initiative, and their opposition to Measure E, the SoccerCity initiative.