Two suicide attackers wearing women's cloaks blew themselves up Friday in a Shi'ite mosque in northern Baghdad, killing at least 40 people and wounding scores, police said. It was the second major attack against Shi'ite targets in as many days. The violence came as US Ambassador Zalmay Khalilzad warned that Iraq faces the possibility of sectarian civil war if efforts to build a national unity government do not succeed, and that such a conflict could affect the entire Middle East. Police Lt. Col. Falah al-Mohammedawi said the blasts occurred at the Buratha mosque, which is affiliated with the Supreme Council for the Islamic Revolution in Iraq, the main Shi'ite party. First reports said the explosions were caused by mortar fire, but al-Mohammedawi said police had confirmed they were suicide attacks. The attack occurred as worshippers were leaving at the end of Friday prayers, the main weekly religious service. Earlier Friday, the Interior Ministry cautioned people in Baghdad to avoid crowds near mosques and markets due to a car bomb threat. A prominent Shi'ite politician, Jalal Eddin al-Sagheer, was among the worshippers but police said he was unhurt. Rescuers carried the bodies from the mosque compound on makeshift wooden wheelbarrows and loaded them on the backs of pickup trucks. The Baghdad city council urged Iraqis to donate blood for those wounded. On Thursday, a car bomb exploded about 300 yards (meters) from the Imam Ali mosque in Najaf, the most sacred shrine in Iraq for Shi'ite Muslims. Ten people were killed, police said. The Interior Ministry had cautioned Baghdad residents to avoid crowds near mosques and markets due to a car bomb threat. The attacks were likely to increase tensions between Sunni and Shi'ite Muslims, already at a high level following the February 22 blast at a Shi'ite shrine in Samarra and reprisal killings. That bombing triggered a war of reprisal attacks against Sunni mosques and clerics. "This explosion is trying to provoke Iraqis to sectarian sedition through bombing the mosques," said Salah Abdul-Razzaq, a Baghdad city council member. The Interior Ministry, which oversees police, said it received intelligence that insurgents were preparing to set off seven car bombs in Baghdad. Al-Mohammedawi said the alert would remain until the bombs are discovered and deactivated. Security forces were searching the city, with orders to protect holy sites and be on the lookout for suspicious cars, the statement said. Citizens were urged to "be cautious, and to avoid gatherings or crowds while leaving markets, mosques and churches." The statement also warned that legal measures would be taken against "any security official who fails to take the necessary procedures to foil any terrorist attack in his area." The ministry faces accusations of militia infiltration in its ranks. Other car bombs were possibly heading to some southern Iraqi provinces as well, the statement said, putting security forces in the south also on high alert. Khalilzad, meanwhile, told the BBC that political contacts among Sunni, Shi'ite and Kurdish leaders were improving, but that within the general population, "polarization along sectarian lines" was intensifying - in part due to the role of armed militias. He warned that "a sectarian war in Iraq" could draw in neighboring countries, "affecting the entire region." He said the best way to prevent such a conflict was to form a government including representatives of all groups. That effort has stalled over Sunni and Kurdish opposition to the Shi'ite candidate to lead the government, Prime Minister Ibrahim al-Jaafari. Khalilzad avoided any criticism of al-Jaafari. He said there were many competent Iraqis capable of leading the government "and Prime Minister al-Jaafari certainly is one of them." Khalilzad said the international community must do everything possible "to make this country work" because failure "would have the most serious consequences for the Iraqis, for sure, but also for the region and for the world." Rising sectarian tensions - worsened by armed, religiously based militias and death squads - have emerged as a significant threat to US efforts to form a stable society in Iraq. The threat escalated dramatically after the February 22 bombing of a major Shi'ite shrine in Samarra, triggering reprisal attacks against Sunni mosques and clerics. Last month, Khalilzad said that "more Iraqis are dying today from the militia violence than from the terrorists," meaning Sunni-dominated insurgents. In the BBC interview, Khalilzad cited the role of armed militias in sharpening sectarian tensions. "There are lots of unauthorized military formation such as militias ... of course, the insurgent groups that are a kind of militia and then of course terrorists that everybody is united against," he said. "What I was saying to the Iraqis is that for the success of Iraq, this problem of unauthorized military formations have to be dealt with." He said US officials were working with the Iraqis to develop a plan for curbing militias and would insist that it be implemented. Khalilzad also confirmed the Americans had been meeting with groups linked to the Sunni-dominated insurgency. He would not specify the groups nor say when and where the meetings were held. But he said they did not include Saddam Hussein loyalists or terrorists, presumably religiously based extremists of al-Qaida in Iraq or the Ansar al-Sunnah Army. "We are talking to people who are willing to accept this new Iraq, to lay down their arms, to cooperate in the fight against terrorists," he said. Khalilzad said he believed those contacts were responsible for a decline in the number of attacks against US and coalition forces. Last month, they suffered their lowest monthly death toll in Iraq since February 2005, although the casualty rate has increased somewhat in the first week of April. But the ambassador also acknowledged that US and Iraqi officials were "a long way" from an agreement with Sunni-led insurgents that might bring an end to the war. US officials have in the past confirmed contacts with people who claimed to have links with the insurgents. It was unclear whether these contacts included insurgent commanders or simply intermediaries who support the war against coalition forces.