Acting Secretary of the Navy Thomas Modly resigned Tuesday after traveling nearly 8,000 miles to Guam to berate thousands of sailors on Monday, later saying he stood "by every word," and then subsequently apologizing for the remarks within the span of about eight hours.

Modly submitted his resignation a day after audio of his speech on the carrier was published by Task & Purpose. James McPherson, Undersecretary of the Army, will be tapped to replace Modly, a defense official told Task & Purpose.

In a memo sent to the entire force shortly before his resignation, Modly apologized for his actions, saying that he lacked situational awareness and let his emotions get the better of him. "The crew deserved a lot more empathy and a lot less lecturing," Modly wrote. " ... I disappointed you by not keeping [the Navy and Marine Corps] out of harm’s way. It’s my fault. I own it."

"This morning I accepted Secretary Modly's resignation," Defense Secretary Mark Esper wrote in a memo he tweeted Tuesday afternoon. "He resigned on his own accord, putting the Navy and the sailors above self so that the USS Theodore Roosevelt, and the Navy as an institution, can move forward."

Modly had been on the job for just over four months after his predecessor, Richard Spencer, was forced out amid a disagreement with President Trump over the handling of the Eddie Gallagher case. This week, Modly came under intense pressure to resign due to his handling of the situation on the USS Theodore Roosevelt, a nuclear-powered aircraft carrier that quickly went from having three COVID-19 cases to hundreds among a crew of nearly 5,000 sailors after a port visit to Vietnam in early March.

Modly spoke over the ship's intercom for roughly 15 minutes on Monday, chastising sailors who enthusiastically cheered for their captain, Capt. Brett Crozier, as he departed the ship. In his remarks, Modly said Crozier was either "too naive or too stupid to be a commanding officer" of their ship since a letter he wrote to Navy leadership subsequently leaked to the press.

Crozier was relieved of command over the leaked letter, in which he pleaded with senior leadership to allow the evacuation of his sailors from the ship since social distancing is practically impossible.

"Crew of the Teddy Roosevelt, you are under no obligation to love your leadership, only respect it," Modly said. "You are under no obligation to like your job, only to do it. You are under no obligation, you are under no obligation to expect anything from your leaders other than they will treat you fairly and put the mission of the ship first."

“That's your duty,” Modly continued. “Not to complain. Everyone is scared about this thing. And let me tell ya something, if this ship was in combat and there were hypersonic missiles coming in at it, you'd be pretty fucking scared too. But you do your jobs. And that's what I expect you to. And that's what I expect every officer on this ship to do, is to do your jobs.”

Several Democratic lawmakers on Monday called for Modly's resignation, while President Donald Trump said he might intervene. Under pressure from Defense Secretary Mark Esper, Modly apologized late Monday.

Meanwhile, Modly also wrote a response to an op-ed published in The New York Times by Tweed Roosevelt, great grandson to Theodore Roosevelt, in which he called Crozier a "hero." The response by Modly was published and later deleted from The Navy's Live Blog, though it still appears on The Times website.

On Tuesday, House Speaker Nancy Pelosi joined other lawmakers in calling for Modly's removal. "Modly's actions and words demonstrate his failure to prioritize the force protection of our troops," Pelosi said in a statement, adding that he showed a "serious lack of sound judgment and strong leadership."

Sen. Jack Reed (D-R.I.), the ranking member of the Senate Armed Services Committee, applauded Modly's resignation and asked for a "thorough review" of the actions of Navy leadership and if The White House played any role in the Crozier's ouster.

"Congress must continue pressing for answers to ensure the health and safety of our sailors and troops comes before political considerations," Reed said in a statement.

Haley Britzky contributed reporting.