By Ibrahim Mshelizza

MAIDUGURI, Nigeria (Reuters) - Nigerian forces swept through the remote northeast on Wednesday, searching houses for suspected Boko Haram militants after killing four in a gunbattle, the military said.

The crackdown on the group in its heartland of Maiduguri followed a spate of attacks in the past few days, including the killing of a prison official and a retired police inspector.

A Reuters reporter saw several military patrols stop in Maiduguri neighborhoods and carry out house to house searches.

Islamist sect Boko Haram has been unrelenting in its low level violent campaign against President Goodluck Jonathan's administration, which has continued since a brief flirtation with peace talks collapsed at the beginning of last week.

Months of gun and bomb attacks blamed on the sect have killed hundreds since it launched its uprising more than two years ago to try to carve out an Islamic state in Nigeria.

On Saturday, gunfire erupted in Maiduguri and in the north's biggest city of Kano, to the west, as militants battled with security forces. The Islamists attacked two police stations with explosives on Saturday, spokesman for the Joint Task Force Sagir Musa said, although they were repelled and three were killed.

Musa said on Wednesday that two militants, including a commander, were killed during an attempt to arrest them the day before as part of the crackdown.

"Following a tip-off, a special operation was conducted that resulted in the arrest of a commander of Boko Haram who was involved in recent attacks in Maiduguri," he said, adding that he was arrested with his lieutenant in Jajeri area of the city.

"They attempted to escape when being moved to detention facilities and were shot and they bled to death before they got to the hospital."

In another incident, two militants were shot dead during a gun battle after they attempted to rob some houses, he said.

Jonathan declared a state of emergency in parts of the north affected by the insurgency at the end of December, boosting the military presence there, but the sect has continued to fight and spread its sphere of influence across the north.

Even northerners opposed to Boko Haram are wary of crack downs by the security forces, who have been accused of being too heavy handed and indiscriminate, radicalizing the population against them and boosting the sect's support base.

Recent arrests and deaths of senior figures have weakened the group, analysts say, and it has not managed to launch a big, coordinated attack since one in Kano that killed 186 people in January, reverting to crude bomb attacks and shootings.

The smaller attacks remain deadly and show no sign of letting up.

(Additional reporting by Mike Oboh in Kano; Writing by Tim Cocks)