A car bomb exploded outside the U.S. Consulate in the northern Iraqi city of Irbil Friday, and a series of bombings ravaged several areas around Baghdad, killing at least 40 people.  

A blast and gunfire was heard in central Irbil, a Reuters witness said, which is unusual in the capital of Iraqi Kurdistan.

“There was an explosion within the perimeter of the U.S. Consulate today, our protocol was activated and all personnel have been accounted for. There were no injuries to local guards or personnel,” State Department spokesperson Marie Harf said Friday.

“Local authorities responded and are securing the area. We will work with the authorities to investigate the facts of the explosion,” Harf  told reporters at a briefing in Washington.

Harf said she could not provide any details on who is responsible for the attack and said Iraq remains a dangerous place.

The large blast went off just outside the consulate building in Irbil's Ankawa neighborhood, setting nearby cars on fire, an Associated Press reporter on the scene said. Kurdish security forces quickly arrived on the scene.

The Islamic State terror group claimed responsibility for the attack, the jihadist monitoring group SITE said Friday. SITE referred to an ISIS Twitter account saying fighters from its Kirkuk division "were able to detonate a car bomb on the building of the American Consulate in the city,”  Reuters reported.    

Meanwhile, a series of bombings ripped through Baghdad Friday, mainly targeting public places and killing at least 40 people, Iraqi officials said.

A car bomb went off at a car dealership in the Shiite neighborhood of Habibya in eastern Baghdad, killing 15 people and wounding 26, police said. Several cars were burned in the attack. A half-hour earlier, a car bomb detonated near an outdoor market, killing 13 people and wounding 24.

No group immediately claimed responsibility for the attacks but violence has escalated both in Baghdad and elsewhere in Iraq in the wake of Islamic State group's capture of large parts of the country last year. The Islamic State has taken credit for similar attacks in the past, especially those targeting Shiites, as well as Iraqi security forces and government buildings.

Iraqi government forces and allied Shiite and Sunni fighters-- backed by airstrikes from the U.S.-led international coalition-- are battling Islamic State militants to retake key cities and territory in northern and western Iraq.  

A roadside bomb exploded near a patrol of Sunni fighters known as Sahwa in southern Baghdad, killing two of the force's members. The Sahwa fighters joined forces with U.S. troops at the height of the Iraq insurgency to fight al Qaeda and other Sunni militants.

Medical officials confirmed the casualties in Friday's attacks. All officials spoke on condition of anonymity because they were not authorized to talk to the media.

The Associated Press contributed to this report.