President Donald Trump said he wants to get U.S. troops completely out of Afghanistan but said Pentagon leaders have convinced him not to, saying the American military presence there is preventing terrorist attacks.

In an interview aired Monday on Fox News (but taped before his visit to North Korea), the president said that the U.S. military force in Afghanistan has dropped to about 9,000 service members, around the same level as when he took office. He added that he wants an end to the 19-year-old war.

“We have the greatest fighters in the world,” Trump said. “But when you're 19 years, you're really becoming like a police force. So we have pulled it back.”

But when pressed why he hasn’t ended the military mission there — a promise he has repeated numerous times since taking office — Trump said unnamed service officials have convinced him that some presence in Afghanistan is still necessary.

“The problem is, it just seems to be a lab for terrorists,” he said.

“That's always a very tough decision, you know, with what happened with the World Trade Center, et cetera, et cetera. When you're standing there, and you have some really talented military people saying, ‘I'd rather attack them over there than have them hit us over here and fight them on our land,’ it's something you always have to think about.”

Late last month, two soldiers were killed in a firefight with Taliban militants. Two veterans who became civilian contractors were also killed in Afghanistan. And Sunday another soldier died in a non-combat incident. So far 10 U.S. military personnel have died in Afghanistan this year, bringing the total of Americans killed in the 19-year-old war to more than 2,400.

Trump added that negotiations are underway with Afghan government and Taliban forces, and that “we will be leaving” the country soon.

“We want to get out,” he said. “We want to get out of a lot of areas that we're in. We shouldn't be there. We shouldn't be there. We're the policeman for the whole world.”

Shortly after taking office, Trump increased the U.S. military presence in Afghanistan to more than 15,000 troops on the advice of military leaders who said insurgent groups were regaining territory and power in the war-torn country.

Trump also defended his decision to hold back on a military response to recent Iranian aggression in the Middle East, saying “a lot of people said that was a great presidential moment.”