Fighting in the Iraq cities of Ramadi and Fallujah on Friday killed at least 32 people, including al-Qaeda leader Abu Abelrahman al-Baghdadi, as tribesmen and government forces battled militants in the Sunni province of Anbar.

Sunni Muslim tribesmen backed by Iraqi troops had been fighting al-Qaeda-linked militants for control of Iraq's western province of Anbar in a critical test of strength for the Shi'ite-led government of Prime Minister Nuri al-Maliki.

Parts of Ramadi and Fallujah, west of Baghdad, have been held by militants for days, harkening back to the years after the 2003 U.S.-led invasion when both cities in Anbar province were insurgent strongholds.

Dressed in black and waving al Qaeda flags, hundreds of Islamist insurgents using machine guns and pick-up trucks mounted with anti-aircraft guns battled tribesmen in the streets of the city of Ramadi on Friday, witnesses, security officials and tribal sources said.

The deployment of tribesmen against the militants was made possible by a deal tribal leaders struck with the Baghdad government late on Thursday to try to counter al Qaeda, which has seized government buildings and police stations in Ramadi and the province's other main city Falluja, tribal leaders told Reuters on Friday.

Al-Qaeda's Islamic State of Iraq and the Levant (ISIL) has been tightening its grip in Anbar, near the Syrian border, in recent months in a bid to create an Islamic state across the Iraqi-Syrian borders.

“ISIL fighters want to keep their foothold that they have got in the past months but there is no way to let al Qaeda keeps any foothold in Anbar,” said one tribal leader, who asked not to be named.

“The battle is fierce and not easy because they are hiding inside residential areas.”

Pictures, circulated on social media, showed police vehicles carrying soldiers and tribesmen in Ramadi after the reportedly ousted ISIL fighters from the city, and reopened police stations there.

On Thursday, one of ISIL’s prominent figures, Shakir Wahib, was killed by a sniper from the Iraqi anti-terrorism forces. The Iraqi forces also killed Abu Hassan al-Dighirdash, ISIL’s preacher, in the northern province of Mosul.

Ahmed Abu Risha, head of the Awakening National Council – a coalition of tribesmen in Anbar - said “there is an open war against ISIL,” and added that the tribes formed a bloc against the al-Qaeda group with the help of local police.

The awakening movement was formed in 2005 to fight against al-Qaeda linked extremists. However, Baghdad’s failure to recruit the awakening movement’s fighters into the formal army and the exacerbation of the conflict in Syria have encouraged al-Qaeda to reemerge in the strategically important Anbar province that connects Iraq to Syria, Jordan and Saudi Arabia.

But not all tribal sheikhs have a similar view.

In an interview with Al Arabiya News Channel, Ali al-Hatim, one of the sheikhs in Anbar, asked “if the Iraqi army is surrounding Anbar, how did ISIL enter the province?” Hatim urged Baghdad to fully withdraw its forces, saying Anbar “will be stable and clear within two hours” if the army retreats.

“There are only problems in the city where the government forces are present, and not near our areas,” he added.

He said that Anbar’s police and the tribes shouldn’t be embroiled in the conflict, or this could lead to a scenario similar to what is happening in Syria.