Washington(CNN) Acting Navy Secretary Thomas Modly resigned on Tuesday, a day after leaked audio revealed he called the ousted commander of the USS Theodore Roosevelt "stupid" in an address to the ship's crew.

Modly's resignation comes a little more than a week after Capt. Brett Crozier, the then-commanding officer of the USS Theodore Roosevelt, sent a memo warning of coronavirus spreading among the sailors on the aircraft carrier. The memo leaked and Modly subsequently removed Crozier from command. The former acting secretary flew to Guam to address the ship, insulting Crozier to thousands of sailors who had given their former captain a standing ovation as he left the ship days before.

The audio of that address was leaked to media outlets and the uproar over Modly's remarks -- calling Crozier "too naive or too stupid" to be in command of the aircraft carrier and saying that going outside of the chain-of-command with his memo represented a "betrayal" -- quickly made his position untenable.

In his resignation letter, Modly did not mention the controversy but later apologized to the whole of the Navy for the incident in a memo.

"More than anything, I owe every member of the Navy and Marine Corps team a lifetime of gratitude for the opportunity to serve for them, and with them, once again. They are the reason why I will forever remain inspired by the call of service. They are the ones who lift our nation, heal our divides, and make this country the greatest in the history of the world," Modly wrote in his resignation letter.

"That is why with a heavy heart, I hereby submit my resignation, effective immediately. The men and women of the Department of the Navy deserve a continuity of civilian leadership befitting our great Republic, and the decisive naval force that secures our way of life. I will be forever grateful for my opportunity, and the blessing, to be part of it."

Defense Secretary Mark Esper said in a letter that he accepted Modly's resignation Tuesday morning, confirming CNN's earlier reporting that Modly had resigned.

"He resigned of his own accord, putting the Navy and Sailors above self so that the U.S.S. Theodore Roosevelt and the Navy, as an institution, can move forward," Esper wrote. "His care for the Sailors was genuine. Secretary Modly served the nation for many years, both in and out of uniform. I have the deepest respect for anyone who serves our country, and who places the greater good above all else. Secretary Modly did that today, and i wish him all the best."

READ: Defense Secretary Mark Esper confirms resignation of acting Navy Secretary Thomas Modly

Undersecretary of the Army James McPherson -- who served on the USS Theodore Roosevelt in the 1980s -- has been tapped to succeed Modly, Esper wrote. McPherson is a retired rear admiral and was the former judge advocate general of the Navy.

'A betrayal'

Modly relieved Crozier of duty late last week after a memo the captain had written to Navy officials leaked to the press. Crozier wrote of the challenge of trying to contain a coronavirus outbreak aboard the ship and urgently requested that sailors be allowed to quarantine on land.

Modly told the crew that Crozier had to go, citing loss of confidence and a failure to adhere to the chain of command. It was a "betrayal of trust, with me, with his chain of command," he said in remarks that were piped over the vessel's public address system.

Modly also suggested Crozier leaked the memo on purpose or was "too naive or too stupid" to be in command if he didn't think that sending it to over 20 people would not result in it getting out to the public.

"If he didn't think, in my opinion, that this information wasn't going to get out to the public, in this day and information age that we live in, then he was either a) too naïve or too stupid to be a commanding officer of a ship like this," Modly said. "The alternative is that he did this on purpose."

At least 230 sailors aboard the Roosevelt had tested positive for coronavirus as of Tuesday morning, an increase of 57 cases since the day before, a US Navy official told CNN.

Officials at the Pentagon are split about whether Crozier should have been relieved, but most feel the situation was badly handled and is now causing additional problems at an already difficult time.

The situation quickly escalated and Trump was asked about Modly's comments during Monday's briefing from the White House coronavirus task force.

"I haven't heard it exactly, I heard they heard," Trump said, referring to the crew of the USS Theodore Roosevelt. "I heard they had a statement that was made, if that were the statement, it's a strong statement."

Trump added that he "may just get involved."

Shortly afterward, Modly moved into damage control mode, but his apology still insinuated that Crozier had deliberately leaked the memo himself.

"I believe, precisely because he is not naive and stupid, that he sent his alarming email with the intention of getting it into the public domain in an effort to draw public attention to the situation on his ship. I apologize for any confusion this choice of words may have caused," he said.

Modly also apologized directly to Crozier for "any pain my remarks may have caused."

"(Crozier and his family), and the entire Navy, have my full commitment that I will continue to help get the TR back to full health and back to sea where we can move forward beyond this unfortunate situation," he said.

"I lost situational awareness"

After he resigned on Tuesday, Modly again apologized for his comments about Crozier and his familiar tone, telling the Navy in a memo that -- upon getting on the ship -- "I lost situational awareness."

"When I walked on the quarterdeck of the TR I lost situational awareness and decided to speak with them as if I was their commander, or their shipmate, rather than their Secretary," Modly wrote. "They deserved better, and I hope that over the passage of time that they will understand the words themselves rather than the manner in which they were delivered. But what's done is done. I can't take it back, and frankly I don't know if I walked back up that quarterdeck today if I wouldn't have the same level of emotions that drove my delivery yesterday."

Modly said he now recognized that the "crew deserved a lot more empathy and a lot less lecturing" during his remarks. He said that he regretted how quickly his words spread through the press and insisted that his true meaning was lost.

"I had hoped to transmit a message of love, and duty, and mission, and courage in the face of adversity," Modly wrote. "Those words are in there, but they are now lost, because of me, and I will regret that for the rest of my life. But, I am not a football head coach, or a master chief, or even the ship's own CO, I am the Secretary of the Navy and you, and they, should expect more out of me. I own it."

Trump, during Tuesday's briefing from the White House coronavirus task force, said Modly "didn't have to resign."

"I had no role in it. The whole thing was very unfortunate," Trump said. "I've heard, I don't know him, but I've heard he was a very good man, and it was a, the whole thing was very unfortunate."

The President again criticized Crozier, saying the captain "didn't have to be Ernest Hemingway" by writing the letter. Trump said he recognized that Crozier's decision to send the letter was a "very unselfish thing for him to do."

"He made a mistake, but he had a bad day, and I hate seeing bad things happen. Man made a mistake. But you know, he shouldn't have been writing letters."

This breaking story has been updated to reflect Undersecretary of the Army James McPherson has been named as Modly's successor after he resigned.