Deputy attorney general Rod Rosenstein submitted his resignation letter to President Donald Trump on Monday, setting an end date of May 11 for his storied and at-times tumultuous stint as the number two official at the Department of Justice.

"I am grateful to you for the opportunity to serve; for the courtesy and humor you often display in our personal conversations; and for the goals you set in your inaugural address: patriotism, unity, safety, education, and prosperity," Rosenstein wrote in his letter to Trump.

Attorney General William Barr lauded Rosenstein's tenure in a statement Monday, noting his 30-year service in various levels of the justice system as "unparalleled."

"Over the course of his distinguished government career, he has navigated many challenging situations with strength, grace, and good humor. Rod has been an invaluable partner to me during my return to the Department, and I have relied heavily on his leadership and judgment over the past several months.

Rosenstein's departure brings a long, unpredictable relationship between the one-time head of special counsel Robert Mueller's investigation and the president to a close.

In late 2018, Rosenstein's future in the administration was cast into doubt after reports emerged in various news outlets that Rosenstein once raised the possibility of secretly recording President Trump or members of the Cabinet invoking the 25th Amendment to remove him from office.

At the time, sources told ABC News that the remarks were "likely in jest" and Rosenstein phoned the president to dispute the accounts.

"My preference would be to keep him and to let him finish up," Trump concluded.

Since then, Rosenstein has assisted Barr in overseeing the conclusion of Mueller's investigation and the release of his final report on Russia's interference in the 2016 election.

Following his appointment of Mueller as special counsel in May of 2017, Rosenstein has weathered an array of criticism from both sides of the political spectrum.

House Republicans threatened to impeach Rosenstein as they accused him of obstructing their efforts to obtain confidential documents they believed would expose corrupt motives at the origin of the Russia collusion investigation into Trump's campaign.

Democrats have also raised concerns over Rosenstein's role in authoring the memo President Trump used to justify his firing of former FBI Director James Comey. They have more recently raised the issue with Rosenstein's decision to join with Barr in his determination that President Trump should not be charged with seeking to obstruct the Russia investigation after Mueller declined to rule on the issue in his final report.

In his resignation letter, Rosenstein made no direct reference to the controversies that have clouded his tenure, and instead stressed his hopes that the department would remain independent from Washington's charged political atmosphere.

"We enforce the law without fear or favor because credible evidence is not partisan, and truth is not determined by opinion polls," Rosenstein said. "We ignore fleeting distractions and focus our attention on the things that matter, because a republic that endures is not governed by the news cycle."

Before becoming deputy attorney general, Rosenstein was the longest-serving U.S. attorney, serving in Maryland.

It’s unusual for U.S. attorneys to withstand presidential turnover, but Rosenstein served throughout both President George W. Bush and President Barack Obama’s administration's, holding the position for 12 years.