PESHAWAR, Jan 30 (Reuters) - A suicide bomber blew himself up inside a crowded mosque in a highly fortified security compound in Pakistan on Monday, killing 59 people, including 27 police officials, the latest in a string of attacks targeting police.

The attacker appeared to have passed through several barricades manned by security forces to get into the "Red Zone" compound that houses police and counter-terrorism offices in the volatile northwestern city of Peshawar, police said.

"It was a suicide bombing," Peshawar Police Chief Ijaz Khan told Reuters. He said the mosque hall was packed with up to 400 worshippers at the time and many of the 170 wounded were in critical condition.

The death toll rose to 59 after several people succumbed to their wounds, hospital official Mohammad Asim said in a statement. Police said 27 of the dead were police officials.

Local Taliban known as Tehreek-e-Taliban Pakistan, an umbrella group of Sunni and sectarian militant groups, denied responsibility.

The bomber detonated his load at the moment hundreds of people lined up to say their prayers, officials said.

"We have found traces of explosives," Khan told reporters, adding that a security lapse had clearly occurred as the bomber had slipped through the most secure area of the compound.

An inquiry was under way into how the attacker breached such an elite security cordon and whether there was any inside help.

There was no immediate claim of responsibility for the attack, the worst in Peshawar since March 2022 when an Islamic State suicide bombing killed at least 58 people in a Shi'ite Muslim mosque during Friday prayers.

Peshawar, which straddles the edge of Pakistan's tribal districts bordering Taliban-ruled Afghanistan, is frequently targeted by Islamist militant groups including Islamic State and the Pakistani Taliban.

"Tehreek-e-Taliban has nothing to do with this attack," the TTP said in a statement.

The bombing happened a day before an International Monetary Fund mission to Islamabad to initiate talks on unlocking funding for the South Asian country's economy, which is enduring a balance of payments crisis.