By Roland Buerk
BBC News, Kabul
The leaders of Pakistan and Afghanistan have promised they will co-operate to defeat terrorism.
Both leaders have become key allies in the US-led war on terror
Gen Pervez Musharraf and newly-elected Afghan President Hamid Karzai were speaking after talks in Kabul.
The borderlands between the two countries are thought to be the hiding place of the last remnants of al-Qaeda.
Gen Musharraf came to Kabul just days after Hamid Karzai's victory in Afghanistan's presidential elections was confirmed.
Relations between the two countries have been strained in the past.
There have been allegations that militants from Afghanistan find sanctuary in Pakistan.
But after talks in the heavily fortified presidential palace in Kabul, both men said the two countries were in the fight against terrorism together.
The borderlands between Afghanistan and Pakistan remain wild and lawless.
American soldiers have been hunting members of al-Qaeda there for years.
It could even be Osama bin Laden's hiding place.
The US military says co-operation in the area has already increased.
A spokesman revealed that earlier in the week Pakistan's army helped to repel a rocket attack on an Afghan town.
From their vantage point in a border check post, Pakistani soldiers directed American and Afghan artillery fire on to militant positions.