One reason that most of the terrorism attacks are now against Iraqi targets is because the foreigners have brought in their own, high quality, security forces. The imported security personnel are usually police or security professionals. The lowest ranking security guard jobs are filled by former military people, often retired after at least twenty years of service. There are hundreds of foreign commercial and aid organizations operating in Iraq, and all have learned that they need to provide some of their own security. The Iraqi police are still relatively scarce, corrupt and inept. American troops concentrate on defending their own bases and troops, and going after the Iraqis and foreign terrorists who are causing most of the mayhem.
For example, there are at least 1,500 South African security professionals in Iraq. Actually, it's illegal for South Africans to be hired and sent to Iraq for security work. So the South Africans are technically doing demining work (considered a humanitarian, not a military, operation), although none of the deminers in Iraq are known to be South Africans.
Most of the security personnel are from the United States, followed by Great Britain and South Africa. The foreign security groups are effective, protecting the foreign operations from criminal, as well as terrorist, attacks. Some Iraqis, who can afford it, also hire foreign security guards. Iraqi security companies are booming as well, and rapidly learning from the foreign outfits in an attempt to stay competitive.