Afghan President Hamid Karzai threatened Sunday to send Afghan troops after notorious Taliban leaders inside Pakistan — an angry warning to his eastern neighbor that he will no longer tolerate cross-border attacks.

The threat — the first time Karzai has said he would send forces into Pakistan — comes only days after a sophisticated Taliban assault on Kandahar's prison freed 870 prisoners, including hundreds of militants from the Islamist movement. It also comes six weeks after Karzai survived his fourth assassination attempt — an attack claimed by the Taliban.

Karzai has long pleaded with Pakistan and the international community to confront tribal area safe havens, and U.S. officials have increased their warnings in recent weeks that the sanctuaries in Pakistan must be dealt with.

Last week, U.S. aircraft dropped bombs along the Afghan-Pakistan border, an incident the Pakistan army said killed 11 of its paramilitary forces. The exchange ratcheted up increasingly touchy relations among the U.S., Afghanistan and Pakistan.

Analysts said they doubt military action by Afghanistan is imminent, but Pakistan's prime minister said the threat "will not be taken well." A Taliban spokesman warned that the Afghan army would be defeated by thousands of armed tribesman.

Speaking on the grounds of his fortified presidential palace, Karzai told a news conference that Afghanistan has the right to self defense, and because militants cross over from Pakistan "to come and kill Afghan and kill coalition troops, it exactly gives us the right to do the same."

Then, Karzai warned Pakistan-based Taliban leader Baitullah Mehsud that Afghan forces would target him on his home turf. Mehsud has been accused in last year's assassination of former Pakistani Prime Minister Benazir Bhutto.

"Baitullah Mehsud should know that we will go after him now and hit him in his house," Karzai said.

"And the other fellow, (Taliban leader) Mullah Omar of Pakistan, should know the same," Karzai continued. "This is a two-way road in this case, and Afghans are good at the two-way road journey. We will complete the journey and we will get them and we will defeat them. We will avenge all that they have done to Afghanistan for the past so many years."

In Pakistan, Prime Minister Yousuf Raza Gilani said his country is a sovereign state that wants good relations with its neighbors. But he said the Afghan-Pakistan border is too long to prevent people from crossing, "even if Pakistan puts its entire army along the border."

"Neither do we interfere in anyone else's matters, nor will we allow anyone to interfere in our territorial limits and our affairs," Gilani told The Associated Press. "We want a stable Afghanistan. It is in our interest. How can we go to destabilize our brotherly country? Such kind of statements will not be taken well by the people of both countries."

A spokesman for NATO's International Security Assistance Force said he would not comment. But another ISAF official said he thought Karzai's comments should be seen as a reflection of frustration with militant safe havens but not as a sign an attack is imminent. He asked not to be identified because he wasn't authorized to speak on the topic publicly.

The U.S. has spent more than US$3 billion the last two years training and equipping the Afghan army, and Karzai's comments raise the specter that a U.S.-trained Afghan military could be used to attack Pakistan. The ISAF official dismissed that idea.

Talat Masood, a retired Pakistani general and security analyst, said Karzai's statements were "an extension of the pressure that is being mounted by the U.S."

"This obviously means that they (the U.S.) are pushing Pakistan to take military action instead of negotiating. There is pressure on Karzai as well, and Karzai is transferring his pressure on us (Pakistan). The pressure on Karzai is more for corruption, more for governance."

As to whether Karzai would really make good on the warning, Masood said, "I wouldn't say it's too serious, but it cannot be ignored."

A spokesman for Tehrik-e-Taliban Pakistan, Pakistan's Taliban movement, warned of an escalation in Taliban attacks against NATO and Afghan forces if Karzai sends forces across the border.

Spokesman Maulvi Umar also said the Afghan army would face defeat at the hands of thousands of tribal fighters. Umar said Karzai is becoming "nervous" due to an increase of Taliban attacks in Afghanistan.

U.S. officials have increased their warnings in recent weeks that the Afghan conflict will drag on for years unless militant safe havens in Pakistan are taken out. Military officials say counterinsurgency campaigns are extremely difficult to win when militants have safe territory where they can train, recruit and stockpile supplies.

Karzai said that in recent fighting in the Garmser district of Helmand province — where hundreds of U.S. Marines have been battling insurgents the last two months — most of the fighters came from Pakistan.

Karzai called Pakistan a "brother government" and "friend," but he also urged it to "act against those elements that are making Pakistan and Afghanistan insecure." He said it was better for Afghan troops to be killed during offensive operations into Pakistan than in militant attacks in Afghanistan.

His comments come as Pakistan is seeking peace deals with militants in its borders, including with Mehsud.

The deals have come under criticism from U.S. officials, who warn truces will simply give militants time to regroup and intensify attacks inside Afghanistan. But Pakistan insists it's not negotiating with "terrorists," but rather with militants willing to lay down their arms.

Pakistan's government also insists it will not allow its territory to be used for attacks on Afghanistan. However, it is unclear whether that is spelled out in the peace deals currently under negotiation.

Mehsud, who is based mainly in the South Waziristan tribal area, has said he would continue to send fighters to battle U.S. forces in Afghanistan even as he seeks peace with Pakistan.

U.S. and NATO commanders say that following the peace agreements this spring, attacks have risen in the eastern area of Afghanistan along the border.

Meanwhile, U.S.-led coalition and Afghan forces killed more than 15 insurgents during a hunt for inmates who fled the Kandahar prison after the attack Friday. The U.S. said it couldn't immediately confirm that any of the 15 killed were escaped prisoners.

The provincial police chief of Kandahar, Sayed Agha Saqib, has said 870 prisoners — including some 400 Taliban militants — escaped from the prison. Saqib said Sunday that Afghan forces have recaptured 20 prisoners, including seven former Taliban inmates.