Acting Secretary of the Navy Thomas Modly submitted his resignation on Tuesday morning and Defense Secretary Mark Esper said on Twitter that he’d accepted the resignation and named Under Secretary of the Army James McPherson to be his temporary replacement.

Modly resigned Tuesday morning following his controversial remarks to the crew of the aircraft carrier USS Theodore Roosevelt about their fired captain, where he labeled him “too naive” and “too stupid.”

In a statement Esper wrote that Modly “resigned on his own accord, putting the Navy and the Sailors above self so that the U.S.S. Theodore Roosevelt, and the Navy as an institution, can move forward.”

“His care for the Sailors was genuine. Secretary Modly served the nation for many years, both in and out of uniform,” Esper wrote. “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.”

In his final “Vector” message to all Navy sailors, Modly said, “It’s my fault. I own it,” about the week’s events with the aircraft carrier and its crew.

Modly wrote that the words he used on the Roosevelt were “poor,” and he told the sailors that they “are justified in being angry with me about that.”

“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,” he 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.”

“The crew deserved a lot more empathy and a lot less lecturing — I lost sight of that at the time and I am deeply sorry for some of the words and for how they were spread across the media landscape like a wildfire,” he added. “I had hoped to transmit a message of love, and duty, and mission, and courage in the face of adversity. Those words are in there, but they are now lost, because of me, and I will regret that for the rest of my life.”

Modly added that he had brought “incoming fire” to the Navy and was “convinced that the fire will continue unrelentingly until the target is gone.”

President Donald Trump later described the situation involving Modly and the comments aboard the Roosevelt as “very unfortunate” and said he “had no role” in his resignation.

Trump said he “would not have asked” Modly to resign and that he did not speak to him, but he thought that “in, really, many ways that was a very unselfish thing for him to do.”

“He didn’t have to resign but he felt it would be better for the country,” Trump said.

The defense secretary said that he spoke with Trump after his conversation with Modly and, with the president’s approval, was appointing McPherson.

The president said it would be up to “regular Navy channels to see what they want to do” with Capt. Brett Crozier, whose leaked letter requesting more Navy assistance to help stop the spread of novel coronavirusaboard his ship triggered the series of events that have culminated with Modly’s resignation.

“The captain should not have written a letter,” Trump said Tuesday. “He didn’t have to be Ernest Hemingway. He made a mistake but he had a bad day. And I hate seeing bad things happen.”

Tune into ABC at 1 p.m. ET and ABC News Live at 4 p.m. ET every weekday for special coverage of the novel coronavirus with the full ABC News team, including the latest news, context and analysis.

Modly had fired Crozier after determining that he had exercised “poor judgment” in distributing the letter to others outside of his chain of command through unclassified channels.

After he was relieved of command, Crozier received rousing cheers by hundreds of his sailors as he walked off the ship for the final time according to videos later posted on social media.

Modly flew to Guam on Monday to address the crew over the ship’s loudspeaker system and blasted Crozier for the letter’s distribution and its eventual leak.

“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, according to a transcript and audio recording of the remarks that were sent to two news organizations. “The alternative is that he did this on purpose.”

Several times he also labeled the letter “a betrayal.”

After those comments drew a firestorm of criticism Modly issued a statement Monday afternoon where he said he stood by his remarks.

But he changed course late Monday night and issued an apology for his use of the words “too naïve” and “too stupid” to characterize the fired ship’s captain.

Two U.S. officials told ABC News that Esper directed Modly to apologize for his remarks.

On Tuesday the Navy said it has tested 79%of the aircraft carrier’s crew of 4,800, with 230 sailors testing positive for the novel coronavirus. The Navy has moved 1,999 sailors to quarantine facilities on Guam as part of its plan to move 2,700 members of the crew ashore.

ABC News’ Elizabeth McLaughlin and Ben Gittleson contributed to this report.

What to know about coronavirus:

  • How it started and how to protect yourself: coronavirus explained
  • What to do if you have symptoms: coronavirus symptoms
  • Tracking the spread in the US and Worldwide: coronavirus map
  • This report was featured in the Wednesday, April 8, 2020, episode of “Start Here,” ABC News’ daily news podcast.

    “Start Here” offers a straightforward look at the day’s top stories in 20 minutes. Listen for free every weekday on Apple Podcasts, Google Podcasts, Spotify, the ABC News app or wherever you get your podcasts.