A senior Navy official who told sailors to “clap like we’re at a strip club” during a visit from Vice President Mike Pence last week has resigned, the service announced Tuesday.

Command Master Chief Jonas Carter of the USS Harry S. Truman stepped down from his position as the ship's enlisted leader and will retire, Capt. Nick Dienna, the commanding officer of the vessel, said in a Facebook post to crew members.

"Onboard USS Harry S. Truman, we measure ourselves by the highest standards of professionalism and personal integrity," Dienna wrote. "I commend Master Chief Carter for having the forthrightness and the courage to uphold this ethos by taking responsibility and holding himself accountable for his comments."

NAVY SAILORS ABOARD USS HARRY S. TRUMAN TOLD TO ‘CLAP LIKE WE’RE AT A STRIP CLUB’ FOR MIKE PENCE

The U.S. Navy confirmed to Fox News the statement was made when Pence visited the ship last week, calling the comments "inappropriate."

Command Master Chief Jonas Carter has resigned after telling sailors to “clap like we’re at a strip club” during a visit from Vice President Mike Pence last week. (U.S. Navy photo by Mass Communication Specialist 3rd Class Joseph A.D. Phillips)

"Truman's commanding officer personally engaged the crew during all-hands calls to ensure that all sailors on board understand that the comments they heard are unacceptable," the Navy said at the time.

Dienna shared a statement from Carter in the Facebook post, which read in part: "When you find yourself making a mistake, own it, accept responsibility and learn from it. Today, I want each of you to know that I have taken full responsibility of my mistake last week and together with my family, I have decided to retire."

NAVY PETTY OFFICER SENTENCED TO NEARLY 10 YEARS IN PRISON FOR DUI CRASH THAT KILLED FOUR PEOPLE

Carter served for nearly 30 years in the Navy, according to Dienna.

"During his seventeen years of wearing his anchors, from his leadership aboard three aircraft carriers and as CMC of the USS Chancellorsville, Master Chief Carter has touched the lives of thousands of sailors and has molded countless future leaders in our Navy," Dienna wrote. "I’ve seen firsthand – and the more than 3,000 sailors aboard Truman can testify to – the incredible impact he’s made to our command."

CLICK HERE FOR THE FOX NEWS APP

Pence had toured the vessel in Norfolk, Va., and thanked those who served.

The Navy had announced plans to scrap the aircraft carrier in February as part of a cost-saving move to bring in more advanced aircraft carriers. The Navy said that the move not to refuel the Truman (with a new nuclear reactor, normally done at the mid-point of ship’s life after 25 years) and retire her early would save $30 billion.

But lawmakers on both sides of the aisles opposed the decision.

The following day, President Trump said he was “overriding the Decommission Order of the magnificent aircraft carrier Harry S. Truman.”

Trump said the ship will be "updated at a fraction of the cost of a new one (which also are being built)!”

Fox News' Kathleen Joyce contributed to this report.