LONDON Pakistan and Afghanistan must redouble efforts to end fighting along their border to prevent this jeopardising an improvement in relations, Pakistani Prime Minister Yusuf Raza Gilani said on Thursday.
In an interview with Reuters, Gilani said he hoped India could "play a good role" in Afghanistan, as warming ties between Islamabad and New Delhi reduce the deep mistrust which has seen the two countries battling for influence there.
"It is in the interest of Pakistan for a stable, peaceful, independent, sovereign Afghanistan," Gilani said. "We are part of the solution and we are not part of the problem."
He said both Afghanistan and Pakistan -- which have had difficult relations in the past over Pakistan's alleged support for the Taliban -- had realised they needed to unite to fight their "common enemy" in Islamist militants.
But a flare-up in fighting along the border has put that understanding at risk.
Pakistan has attributed the clashes to incursions by militants which it had previously chased out of its tribal areas and who then took refuge in eastern Afghanistan.
Afghanistan says at least 42 civilians have been killed by Pakistan army shelling, though President Hamid Karzai has over-ruled senior ministers who wanted to return fire.
Pakistan has denied large-scale shelling, saying only that a few accidental rounds may have crossed the border when it pursued militants who had attacked its security forces.
Gilani said both he and Karzai were under "tremendous pressure" over the border incursions.
"Therefore I am regularly in touch with President Karzai so that there should be no misunderstanding, but we should avoid all these incursions because it can create problems."
The border fighting, often in areas where the United States had thinned out its troops in order to focus on population centres in southern Afghanistan, has alarmed U.S. analysts.
"If this becomes routine -- if Afghanistan starts responding in kind to Pakistani attacks on its territory, then we could very easily see a full-scale war," U.S. Afghan expert Joshua Foust wrote on his blog, Registan.net.
Gilani, however, said that Pakistan was committed to helping bring stability in Afghanistan including through reconciliation with Taliban insurgents.
"I am in favour of political reconciliation which should be Afghan-owned and Afghan-led. Therefore we are ready to support any reconciliation process which is initiated by Afghanistan."
But he said the United States, Pakistan and Afghanistan must all work together -- a prospect which diplomats say has become harder because of strained ties between Washington and Islamabad following the May 2 killing of Osama bin Laden by U.S. forces.
"They should be on the same page because any political settlement we want to be doubly sure that in future that would not affect Pakistan's stability therefore whatever the roadmap be, it should be shared with us."
With the foreign ministers of India and Pakistan due to meet in New Delhi on July 27, Gilani said that, "we really want to make it meaningful and we really want that there should be good results and we want excellent relations with our neighbour".
The two countries resumed in February formal peace talks broken off by India after the November 2008 attack on Mumbai by Pakistan-based militants who killed 166 people. They have since made incremental, but steady progress.
"We decided to discuss all irritants and all core issues so that we should move forward," Gilani said, when asked about what he expected to come out of the foreign ministers' talks.
Though Afghanistan is not officially covered by that peace process, an improvement in relations would also make it easier for them to find common ground there.
The alternative could see Pakistan and India backing rival factions if civil war intensifies in Afghanistan as the United States gradually pulls out combat troops.
"We both have good relations with Afghanistan -- India and Pakistan," Gilani said. And while Pakistan had an important role to play in Afghan stability, "I do hope that India can also play a good role."
He said Pakistan was willing to work with the United States to track down militant leaders, including Ayman al Zawahri, who succeeded bin Laden as head of al Qaeda.
"We have offered them that we should work together and even for other high value targets we should have a mutual cooperation," he said.
"If they have some actionable and credible information, they can share with us. We can jointly work on that."
But he said this did not mean Central Intelligence Agency (CIA) men operating alongside officers of the Inter-Services Intelligence (ISI) agency -- as had happened in the past.
"Not on the ground. There can be some mechanism because we already have some mechanism of intelligence-sharing and joint operations. Therefore whatever in-built mechanism, that can be worked on."
Pakistan has cracked down on U.S. activities on its territory after its suspicions the CIA was running an independent spying operation were confirmed when U.S. forces found and killed bin Laden in the garrison town of Abbottabad.
The United States said it did not trust Pakistan enough to share the information about bin Laden's whereabouts.
"Previously the CIA and the ISI, they have been cooperating for many years ... Even for the Abbottabad incident, some of the initial information was passed on by the ISI," Gilani said.
"Therefore we feel let down when we saw the unilateral action from the United States in Abbottabad. That was something that was not liked by the people of Pakistan."
(Editing by Maria Golovnina)