ISLAMABAD (Reuters) - Pakistan on Thursday responded to Washington’s accusation that it shelters the Afghan Taliban by saying the U.S. military itself is failing to eliminate militant sanctuaries inside Afghanistan.

Pakistan's Defence Minister Khawaja Asif speaks during an interview with Reuters at his office in Islamabad March 6, 2014. REUTERS/Faisal Mahmood

The rare reaction came in a policy statement issued by the office of Prime Minister Shahid Khaqan Abbasi after a meeting of the civilian and military leadership.

President Donald Trump has accused Pakistan of harbouring “agents of chaos” and providing safe havens to militant groups waging an insurgency against a U.S.-backed government in Kabul. Islamabad, he said, must quickly change tack.

Pakistan, however, saw things differently.

“We would like to see effective and immediate U.S. military efforts to eliminate sanctuaries harbouring terrorists and miscreants on Afghan soil, including those responsible for fomenting terror in Pakistan,” the Prime Minister’s office said in a statement, one of the strongest ever responses to Washington. The Afghan war cannot be fought in Pakistan, it said.

The statement referred not only to the Afghan Taliban, but also the loosely affiliated Pakistani Taliban that Islamabad contends uses sanctuaries inside Afghanistan to plan attacks on Pakistani soil.

White House officials have threatened cuts in aid and military support, as well as other measures to force nuclear-armed Pakistan’s hand and bring about an end to the 16-year-war.

Pakistan’s Foreign Minister Khawaja Asif said Washington should not use Pakistan as a “scapegoat” for its failures in America’s longest running war. Pakistan denies harbouring militants.

The military, which has ruled the country for over half its 70-year history, calls the shots on key parts of Pakistan’s foreign policy, including ties with the United States, Afghanistan and arch-foe India.

The prime minister’s office said Washington’s claims it had paid billions of dollars in aid to Pakistan were misleading.

Payments to Pakistan since 2001 accounted for only part of the cost of ground facilities and air corridors used by the U.S. for operations in Afghanistan, it said.

Pakistani officials bristle at what they say is a lack of respect by Washington for the country’s sacrifices in the war against militancy and its successes against groups like al Qaeda, Islamic State or the Pakistani Taliban.

Pakistan estimates there have been 70,000 casualties in militant attacks, including 17,000 killed, since it joined the U.S. “war on terrorism” after the Sept. 11, 2001, attacks on the United States.

“We feel the American administration led by Mr Trump has been totally one sided, unfair to Pakistan and does not appreciate and recognise Pakistan has been a pivotal player,” Senator Mushahid Hussain, chairman of the senate defence committee, told Reuters on Thursday.

Some analysts have suggested putting greater pressure on Pakistan risks driving Islamabad deeper into the arms of China, its northern neighbour which is investing nearly $60 billion in infrastructure projects as part of its Belt and Road initiative.

China’s top diplomat, Yang Jiechi, told U.S. Secretary of State Rex Tillerson in a phone call the United States must value Pakistan’s role in Afghanistan and respect its security concerns, according to Chinese state media. [nL4N1LA1NW]

The relationship between the two countries has endured periods of extreme strain in recent years, especially after al Qaeda leader Osama bin Laden was found and killed by U.S. special forces in Pakistan in a 2011 raid.