WASHINGTON - President Donald Trump on Thursday defended as "well-meaning" a White House official who directed the Navy to obscure the warship USS John S. McCain while Trump was visiting Japan, but he said he had no advance knowledge of the action.

"I don't know what happened. I was not involved. I would not have done that," Trump told reporters as he was leaving the White House for Colorado, where he is scheduled to address an Air Force Academy graduation ceremony.

Trump, however, suggested that his disdain for the late senator, John McCain, R-Ariz., is well-known and that it was understandable that someone would try to keep a warship originally named for McCain's father and grandfather, both Navy admirals, from his view.

"I was not a big fan of John McCain in any shape or form," Trump said. "Now, somebody did it because they thought I didn't like him, OK? And they were well-meaning."

Trump went on to recount differences he had with McCain, including a vote against a Republican health-care bill that has been a frequent target of the president's public ire, even following McCain's death in August from brain cancer at age 81.

Video: President Trump attacked late senator John McCain many times over the years, taking issue with his health-care vote, his time as a prisoner of war in Vietnam and, most recently, his handling of an intelligence dossier. (Jenny Starrs/The Washington Post)

A senior White House official confirmed Wednesday that the person who issued the directive did not want the warship with the McCain name seen in photographs during Trump's visit. The official, who spoke on the condition of anonymity to discuss internal deliberations, said that the president was not involved in the planning, but that the request was made to keep Trump from becoming upset.

Before McCain died, the Navy added his name to the ship. The destroyer is stationed in Japan, where it is being repaired after a fatal crash in 2017.

The crew of the McCain also was not invited to an event during Trump's visit that occurred on the USS Wasp. But a Navy official, speaking on the condition of anonymity, said it was because the crew was released from duty for the long holiday weekend, along with sailors from another ship, the USS Stethem.

A senior Navy official confirmed Wednesday that he was aware that someone at the White House sent a message to service officials in the Pacific requesting that the USS John McCain be kept out of the picture while the president was there. That led to photographs taken Friday of a tarp obscuring the McCain name, said the official, who spoke on the condition of anonymity because of the sensitivity of the situation.

When senior Navy officials grasped what was happening, they directed Navy personnel who were present to stop, the senior official said.

The Wall Street Journal first reported on the White House directive.

The U.S. Navy reportedly went to great lengths to shield Trump from seeing the ship. Officials said they first covered the name with a tarp, then used a barge to block the name and gave the sailors on the ship the day off, the Journal reported. A Navy official told The Washington Post that the barge was moved before the event involving Trump.

Cmdr. Nate Christensen, a Navy spokesman, said that images of the tarp covering the ship are from Friday and that it was taken down Saturday.

"All ships remained in normal configuration during the president's visit," he said in an email, challenging the suggestion that a barge was moved to block it.

The Journal reported that acting defense secretary Patrick Shanahan knew of the White House's concerns and approved military officials' efforts to obscure the name. But Shanahan, speaking to reporters Thursday in Indonesia, denied that account.

"What I read this morning was the first I heard about it," he said.

Army Lt. Col. Joseph Buccino, a spokesman for Shanahan, said the defense secretary "was not aware of the directive to move the USS John S. McCain, nor was he aware of the concern precipitating the directive."

Reports of the White House directive prompted a tweet Wednesday from Meghan McCain, a daughter of the late senator who is a co-host on the ABC program "The View."

The episode also drew considerable fire from Democrats, including South Bend, Indiana, Mayor Pete Buttigieg, a presidential candidate who served in Afghanistan as a Navy Reserve intelligence officer.

"This is not a show," he wrote Thursday on Twitter. "Our military is not a prop. Ships and sailors are not to be toyed with for the benefit of a fragile president's ego."

This article was written by Dan Lamothe, Colby Itkowitz and Josh Dawsey, reporters for The Washington Post.