The team had been setting up a combat outpost.
"The Iraqi soldier who allegedly opened fire fled the scene but was identified by other Iraqi army personnel and was then apprehended" the military statement said.
Two soldiers arrested
Two Iraqi army soldiers are now being held in connection with the incident.
The US military said it was not clear why the Iraqi soldier had opened fire, but two Iraqi generals told the Reuters news agency that the attacker had links to Sunni Arab fighters.
The patrol "was attacked by gunmen and the soldier abused the situation and killed the two soldiers. The soldier was an insurgent infiltrator," Brigadier-General Mutaa al-Khazraji, commander of the Iraqi army's second division, said.
Brigadier-General Noor al-Din Hussein, commander of the Iraqi Army's fourth Brigade, second division, said that the Iraqi soldier had been in the army for only one year and was an Arab from the Jubouri tribe.
"There is some penetration [by insurgents] and we want to purify the Iraqi army. Our soldiers are good and doing well. This is the first time something like this has happened," he said.
In June 2004, two US soldiers were killed by Iraqi civil defence officers patrolling with them. The Iraqi civil defence corps was created after the US invasion in 2003 and was the forerunner of today's Iraqi army.
The deaths come as a new video of the Baghdad sniper, also known as Juba, was posted on the internet.
The video appeared at the end of December and, like the first two films, is a compilation of footage showing US soldiers being shot dead by the sniper.
Juba is said to be from the Islamic Army in Iraq but he never appears in the videos.
The commentary says it aims to tell "the truth to the American people" about their military losses in Iraq.
Juba, a nom de guerre, first appeared on the internet in 2005 in a poor quality film. With his own internet site at www.baghdadsniper.net, Juba is one of the most successful media outlets of those fighting against the US-led forces in Iraq.
Small arms casualties
According to a tally by the independent website www.icasualties.org, 338 US soldiers have been killed since the beginning of the war by "small arms fire" - eight per cent of total US casualties.
At least 48 of them were shot by snipers.
General Kevin Bergner, a US military spokesman, said that sniping "has been a threat to the security environment here for quite some time".
"It is one we deal with on a recurring, routine basis.
"It is one that we have periodically seen in greater numbers at times, and obviously in those circumstances we target our operations accordingly to counter that threat."
Meanwhile a spate of roadside bombs on Saturday in Iraq's Diyala province killed seven people, according to Iraqi officials.