Pakistan Prime Minister Imran Khan will meet U.S. President Donald Trump in Washington later this month, its foreign office said on Thursday, a visit that could help to ease tensions between the two countries.


Trump late last year accused Pakistan of not doing “a damn thing” for the United States despite billions of dollars in aid, angering Islamabad which has long been at odds with Washington over the war in Afghanistan.


By February, Trump said the United States had developed a “much better” relationship and may set up some meetings with Pakistan.


Khan accepted an invitation to visit Washington and will meet Trump on July 22, the foreign office said in a statement.


“The focus will be to refresh the bilateral relationship,” it said.


Pakistan and the United States are officially allies in fighting terrorism but they have a complicated relationship.


Washington depends on Pakistan to supply its forces in neighbouring Afghanistan, where 14,000 U.S. troops are deployed, but ties are strained by allegations that Pakistan offers safe havens to the Afghan Taliban, which Islamabad denies.


Pakistan has played a behind-the-scenes role in supporting U.S. peace talks with the Afghan Taliban, including facilitating travel to negotiations, and is a key player in Washington’s plans to end its longest war.


Earlier this year the United States helped to de-escalate a conflict between India and Pakistan that threatened to spiral out of control when their warplanes engaged in a dogfight over the disputed Kashmir region.