Washington — Thomas Modly, the acting secretary of the Navy, submitted his resignation on Tuesday, one day after a recording of him disparaging the ousted captain of an aircraft carrier dealing with a coronavirus outbreak became public.

Defense Secretary Mark Esper said he accepted Modly's resignation Tuesday morning, and said he is installing James McPherson, the current acting undersecretary of the Army, as Modly's replacement.

"[Modly] resigned on 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 said in a statement. "His care for the Sailors was genuine. Secretary Modly served the nation for many years, both in an 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."

Get Breaking News Delivered to Your Inbox

Modly relieved Captain Brett Crozier of his command of the USS Theodore Roosevelt last week, after Crozier wrote a memo detailing the desperate situation aboard the ship, where dozens of sailors among the 4,000-person crew tested positive for the coronavirus. Crozier sent the memo to more than 20 people outside his chain of command, and it soon made its way to the pages of The San Francisco Chronicle.

Modly spoke to sailors aboard the USS Theodore Roosevelt on Sunday, and explained his decision to remove Crozier from command of the ship. The vessel has been docked in Guam for over a week as sailors are tested for the virus, and rotated through quarantine and isolation on shore as needed.

"It was my opinion that if he didn't think that information was going to get out into the public, in this information age that we live in, then he was, A, too naive or too stupid to be commanding officer of a ship like this," Modly told sailors, apparently to a recording of the address. "The alternate is that he did it on purpose. And that's a serious violation of the Uniform Code of Military Justice, which you are all familiar with."

The acting secretary, who has been on the job since his predecessor was pushed out last fall, backtracked on his comments in a statement Monday, saying he believes Crozier is neither "naive nor stupid."

"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," Modly said. "I apologize for any confusion this choice of words may have caused. I also want to apologize directly to Captain Crozier, his family, and the entire crew of the Teddy Roosevelt for any pain my remarks may have caused."

Videos showed sailors cheering for Crozier as he left the ship Friday following his ouster.

President Trump said Monday that he would "get involved" in the dispute. He emphasized repeatedly that Crozier's letter "shouldn't have been sent," but hinted that Modly's comments might have gone too far.

"With all of that said, his career prior to that was very good. So I'm going to get involved and see exactly what's going on there because I don't want to destroy somebody for having a bad day," Mr. Trump said about Modly.

Pressure was growing for Modly's ouster on Monday and Tuesday. House Speaker Nancy Pelosi was among those calling for his resignation, saying his "actions and words demonstrate his failure to prioritize the force protection of our troops."

"He showed a serious lack of the sound judgment and strong leadership needed during this time. Acting Secretary Modly must be removed from his position or resign," Pelosi said in a statement.

David Martin and Jordan Freiman contributed to this report.