U.S. President Donald Trump said Monday that he could win the nearly 18-year war in Afghanistan "in a week," but that he doesn't want "to kill millions of people" and wipe Afghanistan "off the face of the Earth."

Trump, who met with Pakistan's prime minister, Imran Khan, on Monday, is trying to persuade Islamabad to help get a deal with the Taliban that would end America's longest war.

Trump said Pakistan can use its influence with the Taliban to help the U.S. "extricate" itself from Afghanistan, while Trump offered to mediate in the long-standing dispute between Pakistan and India over the Kashmir region.

India came close to war with Pakistan in February, and accuses Islamabad of supporting militants. India has in the past consistently rejected outside mediation in its dispute with Pakistan.

Trump claims India's Prime Minister, Narendra Modi, asked him to be an arbitrator in the dispute over Kashmir. But the official spokesperson for India's Ministry of External Affairs, Raveesh Kumar, said Modi had not asked Trump to help mediate.

"It has been India's consistent position … that all outstanding issues with Pakistan are discussed only bilaterally," Kumar wrote on Twitter.

Trump and Pakistan Prime Minister Imran Khan speak to the media in the White House on Monday in Washington. (Mark Wilson/Getty Images)

U.S. wants ceasefire

Pakistan, which is suffering economically, wants to reset relations with the U.S. in hopes of securing more investment, trade and possibly a restoration of American aid that Trump cut.

Khan said he's never believed that there was a military solution to the war. He said he thinks the U.S. and the Taliban are closer to a peace deal than ever before.

"We hope that in the coming days we will be able to urge the Taliban to speak to the Afghan government and come to a settlement, a political solution," Khan said in the Oval Office meeting when reporters were present.

Trump wants to wrap up U.S. military involvement in Afghanistan and sees Pakistan's co-operation as crucial to any deal to end the war and ensure the country does not become a base for militant groups like ISIS.

Washington wants Islamabad to pressure Afghanistan's Taliban into a permanent ceasefire and participation in talks with the Afghan government.

The Pentagon said Pakistan's army chief, Gen. Qamar Javed Bajwa, will meet later on Monday with the top American military officer, chairman of the U.S. Joint Chiefs of Staff Gen. Joseph Dunford.

Analysts believe Bajwa will play a key role in behind-the-scenes discussions, with the military looking to persuade Washington to restore aid and co-operation.

Trump and Khan — a former sports star — are both unpredictable and their relationship has been rocky. Monday's visit was meant to smooth tensions and address complex problems facing both nations.

An Indian soldier patrols the line that divides Kashmir between India and Pakistan, in January 2013. India denies Trump's claim he was invited to arbitrate the dispute over the region. (Mukhtar Khan/Associated Press)

In recent years, relations between the U.S. and Pakistan have resembled a yo-yo. They reached rock bottom under former president Barack Obama when the U.S. carried out the raid on al-Qaeda leader Osama bin Laden's compound in Pakistan without giving Islamabad a heads-up. The relationship didn't improve when Trump took office.

In November 2018, Trump tweeted, "We no longer pay Pakistan the $Billions because they would take our money and do nothing for us, Bin Laden being a prime example, Afghanistan being another."

That statement created a furor in Islamabad.

Khan, the former captain of the Pakistani cricket team who assumed office last fall, fired back.

He tweeted that Pakistan has suffered 75,000 casualties and lost $123 billion US in the "US War on Terror," despite the fact that no Pakistanis were involved in the Sept. 11 attacks. He says the U.S. has only provided a "minuscule" $20 billion US in aid.

Both countries are trying to smooth tensions.