The visit to Afghanistan by Pakistan President Pervez Musharraf comes on the heels of a deal that could have ramifications for Afghan complaints about cross-border militancy.

On Tuesday the Pakistani government signed a peace agreement with pro-Taleban militants in North Waziristan, a semi-autonomous tribal area next to the Afghan border.

Over the past year the army has been targeting Taleban and al-Qaeda fugitives who use the lawless region as a base to launch attacks in Afghanistan.

But their supporters among the local tribes were drawn into the fight, leading to fierce battles that killed hundreds.

The accord is meant to end the violence, and it is viewed here as an implicit admission that the government's military strategy has failed.

Deal brokered

According to the terms of the deal, the tribesmen promised to stop attacking the army and to stop crossing the border to fight in Afghanistan.

The government agreed to halt major ground and air operations, free prisoners, retreat to barracks, compensate for losses and allow tribesmen to carry small arms.

The thorny issue of foreign fighters was left ambiguous. The militants promised that all non-Pakistanis would leave North Waziristan, or stay and respect the deal. But the government did not insist that they be registered, as it has done in the past.

A 10-member committee is charged with implementing and monitoring the agreement.

A driving force behind the negotiations was the governor of North West Frontier Province, which borders North Waziristan, Lt Gen Ali Mohammed Aurakzai. He welcomed the accord as "unprecedented in tribal history", and said the inter-tribal council that brokered it had resolved a complicated issue within a few weeks.

Some commentators, however, declared it a victory for the militants.

Possible outcomes

"The government policy has swung from one extreme to another, from the use of brute military force to what appears to be total capitulation to militants," wrote Ismail Khan of the Dawn newspaper.

I think this accord will give legitimacy to the militants

Rahimullah Yusufzai Taleban expert

"The government was desperate [for a solution]. It has bought temporary peace," said Rahimullah Yusufzai, a close follower of Taleban affairs. "I think this accord will give legitimacy to the militants. They will behave as people who fought the army to a standstill."

But will it work?

Similar deals in neighbouring South Waziristan did stop attacks on Pakistani soldiers, although it strengthened the hand of locals who shared the ideology and views of the Taleban.

The accord may ease domestic pressure on President Musharraf, especially from religious parties, which have accused him of waging war on his own people.

Whether it stops cross-border movement remains to be seen.

Implied message

There could be initial success as the various stakeholders seek to show the deal is working. But regional observers are sceptical. And the government will face US, Nato and Afghan demands to resume operations at any sign of violation.

The accord highlights what many analysts here see as the contradiction at the heart of Gen Musharraf's leadership.

As a key US ally in the "war on terror", he is under pressure to crack down on Islamic extremism. But politically that is difficult in a country where sympathy with the Taleban and opposition to American policy run deep, including within his own armed forces.

He will no doubt be explaining details of the peace deal in Kabul. But it is unlikely either the Afghans or the Americans want to hear the message it seems to imply - that the solution is to accommodate and work with the Taleban, rather than confront and try to defeat them militarily.