Acting Pentagon chief Patrick Shanahan told troops and civilian workers Tuesday to avoid political displays while on the job, a reminder that comes after the White House told the Navy to keep the USS John S. McCain out of sight to avoid offending President Donald Trump during a visit to Japan.

In separate memos to civilian and military leaders, Shanahan said their mission to protect and defend the nation should be apolitical.

"Those of us privileged to serve our Nation, in and out of uniform, in the DoD must be the epitome of American values and ethics," Shanahan said.

He told military commanders to remind those in uniform that they must avoid actions that imply Pentagon approval of political candidates or causes. In a memo to the civilian workforce he said personnel may take part in limited political activities, but "they may never engage in such activity while on-duty or in a Federal building."

Both Shanahan and Trump have distanced themselves from the ship incident, in which an unknown official in the White House military office directed the Navy to keep the McCain out of sight, presumably to avoid reminding the president of the late Sen. John McCain.

The warship was named for McCain's father and grandfather and was posthumously rededicated in the name of the senator and former prisoner of war.

The president blamed the order on "well-meaning" staff aware of his dislike of McCain.

Asked about the memos Tuesday, Shanahan said: "What I wanted to do is, after the McCain situation, remind everyone that we're not going to politicize the military. So it's just a good healthy reminder."

Last week, Shanahan ordered his chief of staff deliver a similar message to the White House military office, reaffirming his mandate that the Defense Department must not be politicized.

Shanahan has asked his chief of staff to look into the ship incident and find out what happened, but he also said he is not planning to seek an investigation by the Pentagon's internal watchdog.

Shanahan said he was told that, despite the White House request, the Navy did not move the ship and that a barge that was in front of it was moved before Trump arrived. He said a tarp that had been draped over the ship's name was removed, but it was put there for maintenance, not to obscure its identity.