Pakistan's army chief Raheel Sharif visited Kabul for talks with Afghan President Ashraf Ghani and the two vowed to fight "terrorism and extremism" together.
Sharif arrived on December 17, one day after the massacre of 132 children and nine adults at a army-run school in Peshawar, Pakistan.
The Pakistani Taliban claimed responsibility.
After his meeting with Sharif, Ghani said in a statement, "The time has come for Afghanistan and Pakistan to work together in sincerity and jointly take effective actions against terrorism and extremism."
Sharif also met International Security Assistance Force (ISAF) commander General John Campbell.
Afghanistan has also been facing a spike in terrorist attacks in recent weeks, including a suicide bombing in the southern Kandahar Province during the morning of December 17.
Meanwhile, Pakistani Prime Minister Nawaz Sharif has lifted a moratorium on the death penalty in terrorism-related cases, a day after the Taliban massacre in Peshawar.
Sharif approved the removal of the moratorium on December 17 as Pakistan began three days of national mourning for the victims of the school massacre and devastated families buried their children.
Sharif told a gathering in Peshawar of all parliamentary parties that Pakistan "will fight the war against terrorism keeping in mind the faces of the innocent children" who were killed at their school.
Sharif called the meeting in a bid to bring the country's politicians together in a unified effort against militant violence.
Sharif said that, within a week, "all parliamentary and political leaders will decide a national consensus to defeat terrorism."
Earlier, Sharif pledged to avenge what he called a "national tragedy unleashed by savages."
U.S. President Barack Obama spoke by phone with Sharif on December 17 to express condolences and "unwavering support" after the Taliban attack. "The two leaders acknowledged the shared threat from terrorism and the president made clear that the United States will continue to support Pakistan in its fight against extremism," the White House said in a statement.
Pakistan imposed a moratorium on implementing the death penalty in 2008, but judges have continued to issue death sentences in some criminal and terrorism cases. Rather than being executed, those sentenced to death have remained imprisoned on death row for the duration of the moratorium.
International and Pakistani rights groups say about 800 of some 8,000 prisoners currently on death row in Pakistan were convicted on terrorism charges.
The December 16 attack on the army-run school in Peshawar was one of the deadliest terrorist attacks in Pakistan's history.
The school teaches boys and girls from both military and civilian families.
Pakistan's army said the attack was carried out by seven gunmen, all wearing bomb vests, who systematically went from room to room, shooting pupils and teachers.
Scores of people were killed and wounded before the attackers themselves were killed.
WATCH: Peshawar Mourns Its Dead
A Tehrik-e Taliban Pakistan (TTP) spokesman, who called himself Muhammad Khorasani, phoned an RFE/RL Radio Mashaal correspondent and claimed responsibility for the attack, saying it was retaliation for Pakistani military operations in nearby tribal areas.
In Peshawar and it senvirons, mourners gathered around coffins for the funerals of the victims on December 17 after people across the country staged candlelight vigils overnight.