ISLAMABAD (AP) - Pakistan on Saturday blocked vital supply routes for U.S.-led troops in Afghanistan and demanded Washington vacate a base used by American drones after coalition aircraft allegedly killed 24 Pakistani troops at two posts along a mountainous frontier that serves as a safe haven for militants.

The incident was a major blow to American efforts to rebuild an already tattered alliance vital to winding down the 10-year-old Afghan war. Islamabad called the bloodshed in one of its tribal areas a "grave infringement" of the country's sovereignty, and it could make it even more difficult for the U.S. to enlist Pakistan's help in pushing Afghan insurgents to engage in peace talks.

A NATO spokesman said it was likely that coalition airstrikes caused Pakistani casualties, but an investigation was being conducted to determine the details. If confirmed, it would be the deadliest friendly fire incident by NATO against Pakistani troops since the Afghan war began a decade ago.

A prolonged closure of Pakistan's two Afghan border crossings to NATO supplies could cause serious problems for the coalition. The U.S., which is the largest member of the NATO force in Afghanistan, ships more than 30 percent of its non-lethal supplies through Pakistan. The coalition has alternative routes through Central Asia into northern Afghanistan, but they are costlier and less efficient.

Pakistan temporarily closed one of its Afghan crossings to NATO supplies last year after U.S. helicopters accidentally killed two Pakistani soldiers.

Suspected militants took advantage of the impasse to launch attacks against stranded or rerouted trucks carrying NATO supplies. The government reopened the border after about 10 days when the U.S. apologized. NATO said at the time the relatively short closure did not significantly affect its ability to keep its troops supplied.

But the reported casualties are much greater this time, and the relationship between Pakistan and the U.S. has severely deteriorated over the last year, especially following the covert American raid that killed Osama bin Laden in a Pakistani garrison town in May. Islamabad was outraged it wasn't told about the operation beforehand.

The government announced it closed its border crossings to NATO in a statement issued after an emergency meeting of the Cabinet's defense committee chaired by Pakistani Prime Minister Yousuf Raza Gilani.

It also said that within 15 days the U.S. must vacate Shamsi Air Base, which is located in southwestern Baluchistan province. The U.S. uses the base to service drones that target al-Qaida and Taliban militants in Pakistan's tribal region when they cannot return to their bases inside Afghanistan because of weather conditions or mechanical difficulty, said U.S. and Pakistani officials, speaking on condition of anonymity to discuss sensitive strategic matters.

The government also plans to review all diplomatic, military and intelligence cooperation with the U.S. and other NATO forces, according to the statement issued after the defense committee meeting.

The Pakistani army said Saturday that NATO helicopters and fighter jets carried out an "unprovoked" attack on two of its border posts in the Mohmand tribal area before dawn, killing 24 soldiers and wounding 13 others. The troops responded in self-defense "with all available weapons," an army statement said.

Pakistan army chief Gen. Ashfaq Parvez Kayani condemned the attack, calling it a "blatant and unacceptable act," according to the statement.

A spokesman for NATO forces, Brig. Gen. Carsten Jacobson, said Afghan and coalition troops were operating in the border area of eastern Afghanistan when "a tactical situation" prompted them to call in close air support. It is "highly likely" that the airstrikes caused Pakistani casualties, he told BBC television.

"My most sincere and personal heartfelt condolences go out to the families and loved ones of any members of Pakistan security forces who may have been killed or injured," said Gen. John Allen, the top overall commander of U.S. and NATO forces in Afghanistan, in a statement.

The border issue is a major source of tension between Islamabad and Washington, which is committed to withdrawing its combat troops from Afghanistan by the end of 2014.

Much of the violence in Afghanistan is carried out by insurgents who are based just across the border in Pakistan. Coalition forces are not allowed to cross the frontier to attack the militants. However, the militants sometimes fire artillery and rockets across the line, reportedly from locations close to Pakistani army posts.

American officials have repeatedly accused Pakistani forces of supporting - or turning a blind eye - to militants using its territory for cross-border attacks. But militants based in Afghanistan have also been attacking Pakistan recently, prompting complaints from Islamabad.

The two posts that were attacked Saturday were located about 1,000 feet apart on a mountain top and were set up recently to stop Pakistani Taliban militants holed up in Afghanistan from crossing the border and staging attacks, said local government and security officials.

There was no militant activity in the area when the alleged NATO attack occurred, local officials said. Some of the soldiers were standing guard, while others were asleep, they said, speaking on condition of anonymity because they were not authorized to talk to the media.

Pakistan army spokesman Maj. Gen. Athar Abbas said map references of all of the force's border posts have been given to NATO several times.

Pakistan's prime minister summoned U.S. Ambassador Cameron Munter to protest the alleged NATO strike, according to a Foreign Ministry statement. It said the attack was a "grave infringement of Pakistan's sovereignty" and could have serious repercussions on Pakistan's cooperation with NATO.

Munter said in a statement that he regretted any Pakistani deaths and promised to work closely with Islamabad to investigate the incident.

The U.S., Pakistan, and Afghan militaries have long wrestled with the technical difficulties of patrolling a border that in many places is disputed or poorly marked. Saturday's incident took place a day after a meeting between NATO's Gen. Allen and Pakistan army chief Gen. Ashfaq Parvez Kayani in Islamabad to discuss border operations.

The meeting tackled "coordination, communication and procedures ... aimed at enhancing border control on both sides," according to a statement from the Pakistani side.

The U.S. helicopter attack that killed two Pakistani soldiers on Sept. 30 of last year took place south of Mohmand in the Kurram tribal area. A joint U.S.-Pakistan investigation found that Pakistani soldiers fired at the two U.S. helicopters prior to the attack, a move the investigation team said was likely meant to notify the aircraft of their presence after they passed into Pakistani airspace several times.

A U.S. airstrike in June 2008 reportedly killed 11 Pakistani paramilitary troops during a clash between militants and coalition forces in the tribal region.