BAGHDAD - Two American soldiers were killed when at least one Iraqi soldier opened fire at a military training base in northern Iraq, and a third soldier died in another incident, the U.S. and Iraqi military said Saturday.

The violence highlighted the peril still facing U.S. forces in Iraq, with many armed groups eager to target the Americans before their scheduled withdrawal at the end of this year. Five U.S. soldiers have been killed in the first two weeks of the year, already matching the number of Americans killed in the last three months of 2010.

The attack on a base outside Mosul underscored the delicate position of the U.S. forces, numbering just less than 50,000, as they train Iraqi troops.

The U.S. soldiers were conducting a shooting exercise with their Iraqi colleagues using dummy ammunition when one or two Iraqi soldiers fired live rounds they had stashed away, a senior Iraqi officer said.

A third American was wounded, and U.S. troops returned fire, killing an assailant, the U.S. military said in a statement. Iraqi officers said they believed the shooting was carefully planned.

Meanwhile, the U.S. military reported the death of a soldier in central Iraq, but did not give any further information.

The latest attacks put a new emphasis on the fragility of the Iraqi-American security relationship. An Iraqi soldier killed two U.S. soldiers in September in Tuz Khurmatu, north of Baghdad, and a sniper killed a U.S. soldier in December in Wasit province as the officer guarded a diplomatic team meeting with locals.

The U.S. military is bracing for more attacks this year as it carries out the massive task of removing troops and equipment from the country.

Shiite cleric Muqtada al-Sadr, in his return this month to Iraq after nearly four years in exile, urged his forces to mount attacks against the Americans.

"There remain very real threats to our forces from violent extremists, just as there are daily threats against Iraqi forces," U.S. military spokesman Col. Barry Johnson said. "We know these threats will continue in the months ahead, despite the great progress in security that has been achieved."

But he said the Iraqi security forces are continuing to make strides.