UK Prime Minister David Cameron has expressed horror over the ongoing terrorist attack at a school in the Pakistani city of Peshawar.

More than 126 people, the majority of them children, were killed on Tuesday when a group of militants entered an army-run school, in one of the worst terrorist attacks in the country's history.

Opposition leader Ed Miliband said his thoughts were with those affected by the attack, which began at 10:00 am local time and was ongoing at 14:30.

The UK's Foreign Secretary Philip Hammond said he was "appalled" by the attack.

Former UK foreign office minister Baroness Warsi condemned the attack and said that Pakistan could only deal with terrorists if its national agencies coordinated together to stop terrorism.

The attack began when a group of militants broke in to the school on Tuesday morning.

Mudassir Awan, a worker at the school, said he saw six people scaling the walls of the school.

"We thought it must be the children playing some game," he told Reuters news agency. "But then we saw a lot of firearms with them.

"As soon as the firing started, we ran to our classrooms," he said. "They were entering every class and they were killing the children."