Pakistan has summoned the U.S. ambassador after President Donald Trump threatened to cut off billions of dollars in aid and accused Islamabad of being a safe haven for extremists.

Trump’s comments, which came on January 1 in his first tweet of 2018, have riled Pakistan, which reacted angrily in turn by accusing the United States of “mistrust."

A U.S. Embassy spokesman confirmed on January 2 that Ambassador David Hale had been summoned to meet with Pakistani officials, but he refused to comment further.

Trump’s tweet said that the United States has “foolishly” given Pakistan more than $33 billion in aid over the last 15 years, “and they have given us nothing but lies & deceit, thinking of our leaders as fools.”

“They give safe haven to the terrorists we hunt in Afghanistan, with little help. No more!" he added.

The White House then confirmed it would continue to withhold $255 million in military aid to Pakistan out of frustration over what it has characterized as Islamabad's obstinance in confronting terrorist networks. It first started a “temporary withholding” of the funds, part of a $1.1 billion aid package authorized in 2016 by Congress, in August.

Pakistani Defense Minister Khurram Dastgir Khan returned fire in a tweet, noting that Islamabad "as anti-terror ally has given free to US: land & air communication, military bases & intel cooperation that decimated Al-Qaeda over last 16yrs, but [the United States has] given us nothing but invective & mistrust."

Foreign Minister Khawaja Mohammad Asif told Pakistan's Urdu-language Geo Television that "the United States should hold its own people accountable for its failures in Afghanistan."

"America is frustrated over defeat in Afghanistan. America should take the path of dialogue instead of using military might in Afghanistan," he was quoted as saying.

Asif added that all financial aid from the United States had been "properly audited" and that "services [were] rendered."

The Afghan Ambassador to the United States Hamdullah Mohib welcomed Trump's tweet.

Pakistan “receives funds from the United States to fight against terrorists, but it has not destroyed terrorist safe havens from where terrorists continuously carry out attacks in Afghanistan,” he told RFE/RL on January 1.

"[Trump’s tweet] is a positive message for us, should U.S. pressure on Pakistan increase,” Mohib added. “If the funds that Pakistan receives from the U.S. are cut off, this can exert direct pressure on Pakistan and we welcome this effort."

However, China gave Islamabad its backing, with Foreign Ministry spokesman Geng Shuang saying that Pakistan “has made a prominent contribution to global antiterror efforts."

"The international community should fully recognize this," he added.

Trump and U.S. Vice President Mike Pence have in the past accused Islamabad of supporting terrorist groups that the U.S. president once called “agents of chaos." U.S. officials have also demanded that Pakistan act against the Taliban and Haqqani network.

The frequency of suspected U.S. drone attacks near the Pakistani-Afghan border has increased notably since Trump introduced his Afghanistan strategy in August.

After a meeting with Afghan President Ashraf Ghani and Chief Executive Officer Abdullah Abdullah at the presidential palace in Kabul late on December 21, Pence had sharp words for Islamabad, saying that while Pakistan had much to gain from working with the United States, it also has much to lose by harboring "criminals and terrorists."

"President Trump has put Pakistan on notice," Pence said at the time.