Rep. Trey Gowdy, R-S.C., who has been at the forefront of investigations into both Hillary Clinton and alleged Russian interference in the 2016 election, said Wednesday he would not run for re-election, adding his name to a growing list of Republican lawmakers stepping aside.

In a lengthy statement, Gowdy, a former federal prosecutor, said he would be leaving politics for good to return to a career in the justice system.

"There is a time to come and a time to go. This is the right time, for me, to leave politics and return to the justice system," wrote Gowdy, who was elected in 2010.

"I will not be filing for re-election to Congress nor seeking any other political or elected office; instead I will be returning to the justice system," he added. "Whatever skills I may have are better utilized in a courtroom than in Congress, and I enjoy our justice system more than our political system."

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Gowdy didn’t elaborate in his statement on what a return to the justice system would entail. But less than 24 hours before he sent out his note, a vacancy on the 4th Circuit Court of Appeals — which includes jurisdiction over district courts in South Carolina — opened up, fueling speculation that he was eyeing the post. An appointment to that judgeship requires a presidential nomination and Senate confirmation.

As recently as Wednesday morning, Gowdy's team had sent out a fundraising email saying that "tremendous challenges" remain and that "we are in a fight for the future of this country." A spokesman for Gowdy, however, told NBC News that the email was sent in error by an outside company that handles fundraising.

Gowdy, the chairman of the powerful House Oversight Committee and a member of the House Judiciary Committee, also headed the select House Committee that had been charged with investigating the 2012 attack in Benghazi, Libya. As part of that probe, Gowdy took a lead role in examining Clinton's response to the attack — an issue critics used against the Democratic nominee during the 2016 presidential race.

In addition, Gowdy, who sits on the House Intelligence Committee, has taken a key role in that body’s investigation into Russia interference in the election.

He has previously spoken about how such investigations are unavoidably colored by politics.

"There are Democrats on (the committee) that earlier this year were talking about collusion. When you reach the conclusion and then go looking for the facts to support it, it is a very different journey than if you do not," Gowdy said in December. "And I am sure that there are Republicans who would say nothing wrong was done no matter what facts come out."

Gowdy’s district, which includes most of the cities of Greenville and Spartanburg in the northwestern part of the state, has a robust conservative and evangelical base of voters and is comfortably Republican. The district went for Trump over Clinton in the 2016 race 60 percent to 34 percent and Gowdy won his last re-election race by a 36-point margin.

His announcement, however, is just the latest by a growing string of Republicans who have said they will leave Congress — a trend that is widely expected to boost the prospects of a Democratic wave in November.

On Monday, 12-term Rep. Rodney Frelinghuysen, R-N.J., announced he was retiring, and earlier this month, Reps. Darrell Issa and Ed Royce, both California Republicans, said they, too would not run for re-election.

Including Gowdy, at least 20 Republican incumbents have said they will retire this year.

Democrats need to win 24 seats to flip the House and the president's party has lost an average of 32 in every midterm election since before the Civil War. In just two extreme instances — during the Great Depression and after the Sept. 11 attacks — has the president's party picked up seats in their first midterm.