President Donald Trump. REUTERS/Joshua Roberts President Donald Trump turned to Twitter on Thursday morning to attack Sen. John McCain for criticizing a US military raid in Yemen last month.

"Sen. McCain should not be talking about the success or failure of a mission to the media," Trump tweeted. "Only emboldens the enemy!"

He continued: "He's been losing so long he doesn't know how to win anymore, just look at the mess our country is in — bogged down in conflict all over the place."

Trump then said Chief Petty Officer William "Ryan" Owens, the Navy SEAL who was killed in the raid, died on a "winning mission."

McCain, the chairman of the Senate Armed Services Committee, called the raid a "failure" earlier this week. He later walked back his remark but continued to challenge the success of the raid.

"I would not describe any operation that results in the loss of American life as a success," he said in a statement.

White House press secretary Sean Spicer also criticized McCain for his comments earlier this week.

"I think anyone who undermines the success of that raid owes an apology ... to the life of Chief Owens," he said in response to a question about McCain's comments.

The raid on Al Qaeda forces in Yemen was Trump's first significant military action as president. It resulted in the deaths of Owens, 14 Al Qaeda militants, an 8-year-old girl, and several other civilians.

NBC reported that the raid intended to take out the leader of Al Qaeda in the Arabian Peninsula, Qassim Al-Rimi, who survived the raid and later mocked Trump on an audio recording.

The NBC report quotes a senior military official as saying "almost everything went wrong" with the dead-of-night raid, including a $70 million MV-22 Osprey aircraft suffering a hard landing and having to be destroyed in place by a US Marine Corps Harrier jet.

Alex Lockie contributed to this report.