The White House asked the Navy to hide a destroyer named after Senator John McCain in order to avoid having the ship appear in photographs taken while President Trump was visiting Japan this week, White House and military officials said Wednesday.

Although Navy officials insisted they did not hide the ship, the John S. McCain, they did give all of the sailors aboard the day off on Tuesday as Mr. Trump visited Yokosuka Naval Base.

Two Navy sailors, who spoke on the condition of anonymity because they were not authorized to speak publicly, said that the McCain sailors were not invited to hear Mr. Trump speak that day aboard the amphibious assault ship Wasp, while sailors from other American warships at the base were.

[What you need to know about about the U.S.S. John S. McCain]

A Navy service member based on Yokosuka said that all of the American warships in the harbor were invited to send 60 to 70 sailors to hear Mr. Trump’s address, with the exception of the McCain. When several sailors from the McCain showed up anyway, wearing their uniforms with the ship’s insignia, they were turned away, the service member said.