WASHINGTON — President Donald Trump on Wednesday painted a vivid picture of the part of his job as commander in chief that has shaped his thinking on pulling back troops in the Middle East — the moments he has shared with the families of slain soldiers.

After spending nearly 45 minutes taking questions from reporters at the White House, during which he attacked Democrats and said there was a “spy” in the White House, Trump, unprompted, turned to his experience seeing the remains of soldiers brought home at Dover Air Force Base.

Trump said that when he has arrived at Dover to meet the families, he is surprised at how well they often seem to be dealing with their loss. A month after taking office, Trump traveled to Dover for the return of the remains of Chief Petty Officer William "Ryan" Owens, a Navy SEAL, killed during a raid in Yemen. He visited again in January when the remains of four Americans killed by a suicide bomber in Syria were returned.

“I see people that were smiling, saying, 'Oh Mr. President, thank you for being here,'” he said.

But he then detailed the heartbreaking scene he said he has witnessed when the massive cargo plane arrives and the coffin with their loved ones' remains packed in ice is carried out with soldiers on each side and an American flag draped over the top.

“I’ve seen people that I thought were really incredible the way they were, I didn’t even understand how they could take it so well, scream like I’ve never seen anything before,” Trump said. “Sometimes, they’ll run to the coffin. They’ll break through military barriers, they’ll run to the coffin and jump on the coffin.”

“Crying mothers and wives, crying desperately,” Trump said. “And this is on these endless wars that just never stopped and there’s a time and there’s a place, but it’s time to stop.”

Trump has been criticized in the past for lacking sensitivity with regard to the families of slain service members. During the 2016 campaign, when the parents of fallen soldier Humayun Khan denounced Trump’s policies during the Democratic National Convention, Trump belittled the mother for not speaking. During his first year in office, the widow of Army Sgt. La David Johnson said that the phone call she received from Trump before meeting her husband’s body at Dover Air Force Base only made her more upset, saying that Trump seemed to struggle to remember her husband’s name.

But Trump said Wednesday the letters he sends to the families — five he said he signed last week for losses in Afghanistan and one in Iraq — have taken a toll on him, as have his visits to the Walter Reed National Military Medical Center.

“The hardest thing I have to do, by far, much harder than the witch hunt, is sign letters to parents of soldiers that have been killed,” Trump said in defending his desire to get U.S. troops out of the Middle East.

Trump was denounced by even his closest allies in Congress for his decision this week to move American troops out of a region of Syria, clearing the way for a Turkish operation. Critics said that move could result in the slaughter of Kurdish allies who have fought side by side with U.S. forces to defeat and contain the Islamic State militant group, or ISIS.

Turkey launched airstrikes in northeastern Syria on Wednesday, Kurdish militia leaders and eyewitnesses said, prompting panic among civilians in the region and despair among the fighters who have been crucial U.S. allies in the campaign against ISIS. Sen. Lindsey Graham, R-S.C., a fierce Trump loyalist, has urged the president to change course.

"Pray for our Kurdish allies who have been shamelessly abandoned by the Trump Administration. This move ensures the reemergence of ISIS," he tweeted.

But Trump has been unmoved.

“I think Lindsey would like to stay there for the next 200 years and maybe add a couple of hundred thousand people every place,” Trump said. Trump later added, “It’s easy to talk tough.”

Turkey maintains it is trying to secure its borders and wipe out "terrorists" and will eventually seek the return of Syrians to their country, millions of whom have fled the civil war. The Kurds, however, say the operation is mainly aimed at crushing them.

The Syrian Democratic Forces are led by the Kurdish People's Protection Units (YPG), which has long angered the Turkish government and Turkish President Recep Tayyip Erdogan. Turkey views the YPG an extension of the separatist Kurdistan Workers’ Party, which is considered a terrorist group by the United States.

NBC News could not independently confirm the airstrikes and other SDF accounts, but pictures from the area showed civilians fleeing as smoke billowed in the background, and Turkish television broadcast video of warplanes taking off from military bases.

Trump said that if Erdogan didn’t act humanely toward the Kurds, he would “wipe out” the Turkish economy, repeating a threat he made earlier in the week.

In addressing what should be done with ISIS fighters detained by the Kurds, he said Europe should take them and that if they escape during the Turkish operation, they will head to Europe anyway.

Trump's remarks on his experience with military families came at the end of a wide-ranging question-and-answer session with reporters following the signing of an executive order on regulations. He said he wants to find out the identity of the person who raised alarm bells to the whistleblower about his conversation with the Ukrainian president at the center of House Democrats' impeachment inquiry, and called that individual a spy.

"I think it is important to find out who that person is because we could have a spy," Trump said. Raising concern about calls he makes with other world leaders, he added, “I don’t want to have spies in the White House, I want to be free to make calls.”

A day after sending a defiant letter to the House saying the White House would stonewall its investigation, Trump suggested that he was open to cooperating if he and Republicans were “getting a fair shake.” But he said he expects his legal challenge to the probe to end up in the Supreme Court.