In one of the worst terrorist attacks in Pakistan's history, militants belonging to the Pakistani Taliban on Tuesday launched a brazen attack on a military-run school in the city of Peshawar. Officials said the eight-hour siege left at least 141 people dead, most of them students.

Tehrik-e-Taliban claimed responsibility for the deadly assault, saying the attack was a response to the military's recent offensive against the militants. "We selected the army's school for the attack because the government is targeting our families and females," Muhammad Umar Khorasani told reporters. "We want them to feel the pain."

Tuesday's attack started around 10 a.m. local time, when gunmen entered the Army Public School and Degree College in Peshawar and opened fire on students and teachers. Security forces quickly rushed to the scene.

Explosions and gunfire were heard inside the building several hours after the attack had started. According to Reuters, several of the attackers detonated suicide vests as the gunfight between militants and security forces intensified.

Peshawar police announced a little after 6 p.m. local time that the attack was over and all of the gunmen had been killed.

Pakistan's army said that while some reports said the militants had taken students hostage, the attackers never released demands. "Their sole purpose, it seems, was to kill those innocent kids. That's what they did,” Major General Asim Bajwa said during a press conference.

The uncle and cousin of injured student Mohammad Baqair, center, comforts him as he mourns the death of his mother, who was a teacher at the school attacked by the Taliban in Peshawar on Tuesday. (AP Photo/Mohammad Sajjad)

As the day progressed, families rushed to local hospitals to locate injured students and retrieve the bodies of those who were killed.

"My son was in uniform in the morning. He is in a casket now," one grieving father, Tahir Ali, cried out as he came to collect the body of his 14-year-old son from the hospital. "My son was my dream. My dream has been killed."

Traumatized children who were lucky enough to escape alive recalled the bloodshed. "While we were being moved out, we saw bodies of our classmates lying in the corridors," one student told DawnNews.

"We were in the examination hall when all of sudden firing started and our teachers told us to silently lay on the floor," one student inside the school at the time of the attack told a private television channel. "We remained on the floor for an hour. There was a lot of gunfire. When the gunfire died down our soldiers came and guided us out."

Shahrukh Khan, 16, was shot in both legs while hiding under a desk as the attackers moved through his classroom, picking off students. "I folded my tie and pushed it into my mouth so that I wouldn't scream," he told Agence France Presse.

Pakistani army troops cordon off a road leading to a school under attack by Taliban gunmen in Peshawar, Pakistan, on Tuesday. (AP Photo/Mohammad Sajjad)

Reuters explains that the school targeted by the militants was run by the Pakistani army. The student body included a few students who were children of civilians, but most children were the sons and daughters of soldiers. At least 500 students aged between 10 and 20 were present inside the building at the time of the attack.

Schools and other symbols of education have been a frequent target of radical militants in Pakistan, the Guardian points out, as they are seen as representing both the government and un-Islamic traditions. In October 2012, Taliban militants shot then 15-year-old Malala Yousafzai, a young activist for girls' education. "She was pro-west, she was speaking against Taliban and she was calling President Obama her ideal leader," a spokesman for the Pakistani Taliban told Reuters in the wake of the assassination attempt. "She was young but she was promoting western culture in Pashtun areas," he added.

The Taliban pointed at casualties at the hands of the Pakistani military to justify today's brutal assault. The battle between the army and the Taliban intensified this summer when the military launched an offensive against the militants in the North Waziristan tribal area in the wake of an attack on the Karachi international airport. More than a thousand fighters and civilians have reportedly been killed since the start of the offensive, named Operation Zarb-i-Azb. The Taliban has responded to the offensive with brutal violence, including a suicide attack on a ceremony at the Wagah border post.

Major General Asim Bajwa vowed on Tuesday the army will continue its fight against the militants and will eventually eradicate the group. "Extremely saddened, our resolve has taken new height. Will cont go after inhuman beasts, their facilitators till their final elimination," Bajwa wrote on Twitter.

The Pakistani military carried out several raids on Tuesday, including 10 bombings in the tribal areas.

Pakistani parents escort their children outside a school attacked by the Taliban in Peshawar, Pakistan, on Tuesday. (AP Photo/B.K. Bangash)

Pakistanis were shocked by Tuesday's events. Prime Minister Nawal Sharif traveled to Peshawar on Tuesday and announced three days of national mourning. "These are my children and it is my loss," he said.

Many Pakistanis took to social media to express their condolences and call for unity in the wake of the tragedy.

Please don't use the Taliban school attack to make political points right now. Children & teachers in danger. Pray, send positive thoughts. — Bina Shah (@BinaShah) December 16, 2014

Yet the attack also put the spotlight on the rampant insecurity in the country.

"The question that doesn't stop ringing in the head is this: what could we have done that we didn't do to save our children? A lot," journalist Syad Talat Hussain wrote on Twitter.

Women supporters of the Muttahida Quami Movement pray during a candle light vigil for the victims of a Taliban attack on a school in Pakistan on Tuesday. (AP Photo/Fareed Khan)

Tuesday's attack drew condemnation from leaders around the world.

President Barack Obama condemned the attack "in the strongest terms." "Our hearts and prayers go out to the victims, their families, and loved ones," Obama said in a statement.

British Prime Minister David Cameron said the attack defies belief. "It is a dark, dark day for humanity when something on this scale happens with no justification," he added.

Nobel Prize winner Malala Yousafzai said in a statement that she was "heartbroken" by the violence.