The gunfire was the reason the US military bombed the mosque, according to Captain Bruce Frame, the spokesman at the command's Tampa, Florida headquarters.
"Initial reports indicate five US casualties, based on fire coming from the mosque," said Frame, who could not say whether they were dead or wounded.
"This was before the air strike, that's why it was run," added the Central Command spokesman.
Mosques are on a list of targets that cannot be hit in attacks. But the spokesman said: "The mosque lost its protected status when it was used as a firing point by the insurgents."
As many as 40 suspected insurgents were believed to have been inside the mosque at the time of the strike, according to a Marines officer in Iraq.