SINGAPORE — The acting defense secretary, Patrick Shanahan, distanced himself on Friday from a Trump administration decision to try to hide a ship named after Senator John McCain during the president’s visit to a naval base in Japan this week.
Mr. Shanahan, who was in Singapore for a security conference, told reporters that he would not have moved the destroyer to keep it out of photos with Mr. Trump.
The White House military operations office told the Navy to block the ship from view, and it complied by at first placing a tarp over the name of Mr. McCain, a fierce critic of Mr. Trump who died last year, and then moving a barge near the vessel.
“I would not have moved the ship,” said Mr. Shanahan, who is facing a tough Senate confirmation battle. “I would not have given that direction.”
Mr. Shanahan has strenuously denied that he was aware of either the White House request or any moves the Navy made to comply with it. He said that he had asked his chief of staff to get to the bottom of the issue and that he hoped to have answers soon.
“Our business is to run military operations and not become politicized,” he said.
Mr. Trump, for his part, said on Thursday that he did not know about the effort to hide the ship and would not have ordered it to be obscured, but he expressed sympathy for his staff.
“Now, somebody did it because they thought I didn’t like him, O.K.?” Mr. Trump told reporters, referring to Mr. McCain. “They were well meaning, I will say. I didn’t know anything about it. I would never have done that.”
Mr. Trump routinely shrugs off the conventions of his office, like avoiding actions that inject politics into military affairs. It would be much more politically difficult for Mr. Shanahan to dodge questions about an episode like the measures taken to obscure the ship.
Mr. Shanahan’s confirmation hearing in the Senate is expected in June, although no date has been set, and he is expected to face tough questioning from Mr. McCain’s former colleagues. Even before the dispute about the ship, Mr. Shanahan was under scrutiny for his lack of military experience and his deep ties to Boeing.
On issues like Mr. Trump’s proposals for a border wall and Space Force, Mr. Shanahan has taken pains to support White House requests, many of which were delayed by his predecessor, Jim Mattis.
But senators on both sides of the aisle viewed Mr. Mattis as a sturdy check on Mr. Trump, and Mr. Shanahan’s efforts to avoid angering his boss could cause problems with the lawmakers who will decide whether to confirm him.
In Washington, critics said that Mr. Trump’s dislike of Mr. McCain had set off a cascade of decisions by lower-level officials that not only dishonored the senator’s memory but also disrespected the sailors who serve on the ship that carries his name.
In addition to Mr. McCain, the ship is named after his grandfather, John S. McCain Sr., a Navy admiral during World War II, and his father, John S. McCain Jr., an admiral in the Vietnam War era.
Sailors aboard the McCain were not invited to hear Mr. Trump speak when he boarded a nearby assault ship, the Wasp, but sailors from other American warships at Yokosuka Naval Base in Japan were welcomed aboard.
A Navy service member based at Yokosuka said that sailors from the McCain who showed up in uniform to hear Mr. Trump speak were turned away.
After the ship’s name was covered with the tarp, high-level officers ordered it taken down, but a barge was then moved in front of the destroyer before Mr. Trump arrived.
More than 36 hours after the first reports of the maneuvers surfaced, top Pentagon officials said they were still searching for answers about why the Navy had complied with the White House request.
The Navy has also said it is reviewing whether it should reprimand service members who wore red patches that read “Make Aircrew Great Again” — a play on Mr. Trump’s campaign slogan — on their flight suits during the president’s speech.
On Friday afternoon, the area near the Yokosuka base was quiet, with a handful of off-duty American sailors running errands. Giant pictures of Mr. Trump looked down on passers-by from a department store, and a nearby hamburger shop was serving a Trump burger — more than a pound and a half of beef with peanut butter, topped with sloppy joe sauce and jalapeños.
Sailors near the base said they were aware of the dispute but had otherwise not taken much notice of it. Some said they had grown used to Mr. Trump’s unorthodox ways and were not surprised that the White House had sought to hide the ship.
The base was closed during Mr. Trump’s appearance because of tightened security, and most of the sailors welcomed the opportunity to rest, they said.