Gunmen killed three people in an attack on Sunni Muslim homes Friday, then opened fire on two Sunni mosques before fleeing at the arrival of U.S. and Iraqi troops, police said.

The attack came in the capital's northern Hurriya area, a neighborhood with a mix of Shiites and Sunnis.

About 20 gunmen drove in in five cars, then attacked several houses and set fire to two, said police Lt. Maithem Abdel-Razzaq. In addition to the people killed, one more was wounded.

CountryWatch: Iraq

They then opened fire on the mosques, damaging the buildings but not causing any injuries, Razzaq said. When U.S. and Iraqi soldiers arrived, supported by helicopters, the gunmen fled.

The 10:15 a.m. attack came 45 minutes before a vehicle ban and curfew put in place to try to prevent sectarian violence against worshippers on the Muslim holy day. Under the regulations, no vehicles are allowed on the streets between 11 a.m. and 3 p.m. — when people would be at prayer or going to or from mosques — and people are restricted to their own neighborhoods.

The rules were put in place after the Feb. 22 bombing of a Shiite shrine in Samarra, 60 miles north of Baghdad, which inflamed tensions between Shiite and Sunni Muslims and triggered months of reprisal attacks.

Visit FOXNews.com's Iraq center for more in-depth coverage.