Authorities in northern Pakistan were looking for 384 inmates who escaped from a prison early Sunday morning after hundreds of Taliban militants raided the facility.

The attack took place in the city of Bannu in northwest Pakistan, an area known for a heavy militant presence.

Four prison officials were wounded in the attack, which lasted more than two hours, said Iftikhar Khan, a senior police official in the city.

Of the 944 prisoners the facility held, 384 escaped, officials said.

Among them were 21 high-profile militants, said Iftikhar Hussain, the information minister of the Khyber Pakhtunkhwa Province, where Bannu is located.

The attackers apparently were aiming to free a senior Taliban commander, he said, but prison records were destroyed in the attack, and officials were still working to verify the names and crimes of those who escaped.

JUST WATCHED

Insurgents create havoc in Afghanistan

MUST WATCH

Insurgents create havoc in Afghanistan02:41

"This is beyond terrorism. Such an attack challenges the writ of the state," Hussain said.

Two of the inmates who escaped had been awaiting execution.

One, Adnan Rashid, had been found guilty in the attempted murder of former President Pervez Musharraf in 2003. The other, Safi Ullah, was convicted of several bombings in northern Pakistan in recent years, officials said.

Authorities were investigating how militants managed to enter the city, Hussain said.

"A soul-searching investigation is underway to answer some big questions," he said. "How were the militants allowed to block routes to the jail before the attack? Why didn't the reinforcements arrive?"

The Pakistani Taliban claimed responsibility for the attack, according to its spokesman Ehsanullah Ehsan.

"We will go where we need to go" said Ehsan, vowing to continue attacks that would result in the release of other imprisoned Taliban fighters.