Key U.S. allies Afghanistan and Pakistan must join forces to fight the "common enemy" of terrorism and extremism being fanned by Al Qaeda and Taliban militants, Pakistan's president said Wednesday.

But visiting President Gen. Pervez Musharraf also said Pakistan would never allow U.S.-led coalition forces — currently hunting Al Qaeda and Taliban fighters on the Afghan side of the border — into tribal areas on its side.

"On our side of the border there will be a total uprising if a foreigner enters that area," he said at a joint news conference with Afghan President Hamid Karzai. "It's not possible at all. We will never allow any foreigners into that area. It's against the culture of the people there."

The leaders held talks on counterterrorism Wednesday amid the deadliest surge in insurgent-linked violence in five years.

The meeting came a day after Pakistan's government and pro-Taliban militants signed a peace agreement aimed at years of violent unrest on the Pakistani side of the porous border with Afghanistan. Under the deal, the militants are to halt attacks on Pakistani forces in the North Waziristan region and stop crossing into Afghanistan to attack U.S. and Afghan forces.

Musharraf warned that he would not allow the area to become a terrorist sanctuary.

"Any militant activity will be addressed with force," he said.

Click here to visit FOXNews.com's Afghanistan Center.

Other Pakistani officials also rejected criticism that the change in tactics could allow Taliban and Al Qaeda loyalists to operate unchallenged there and said it remained committed to hunting down Usama bin Laden.

"Pakistan is committed to its policy on war on terror, and Usama caught anywhere in Pakistan would be brought to justice," army spokesman Maj. Gen. Shaukat Sultan told The Associated Press.

In his remarks Wednesday, the Pakistani president said his country and Afghanistan — whose ties have been frayed over allegations of cross-border attacks by Taliban militants since the Sept. 11, 2001, attacks — should have "brotherly" relations.

"The key obstacle in the area ... is the scourge of terrorism and extremism," he said. "This is the scourge that we have to fight."

He said the two neighbors were battling the triple threat of Al Qaeda, the Taliban and "Talibanization" of society.

"We have to fight Al Qaeda, we have to fight the Taliban who are fighting us militarily, and we have to fight Talibanization, which is more a state of mind and needs a different strategy to address," Musharraf said. "We have a common enemy," Musharraf said.

Pakistan's tribal regions, including North and South Waziristan, have witnessed increased Taliban influence since Pakistani forces deployed to the region after the Sept. 11 attacks and subsequent U.S.-led invasion of Afghanistan that ousted the Taliban from power.

Pro-Taliban forces have been dispensing punishment reminiscent of the hard-line regime's measures in Afghanistan, for acts such as playing music or men not growing beards in line with Islamic custom.

Karzai met earlier Wednesday with another high-level visitor, NATO Secretary General Jaap de Hoop Scheffer, and signed an accord to boost security and development in war-ravaged Afghanistan.

"It is clear that some of the terrorists, the spoilers, think they can win in the south," de Hoop Scheffer told reporters.

"They are wrong. Because they cannot win, they will not win," the NATO chief said. "That is why we are engaged in combat as well at this very moment."

De Hoop Scheffer's comments came a day after U.S. artillery and air strikes reportedly killed up to 60 militants in the volatile south and some 700 militants were believed surrounded by soldiers in Kandahar province, where violence has forced more than 1,500 families from their homes.

Click here to visit FOXNews.com's Asia center.