South Carolina Republican Rep. Trey Gowdy, the chairman of the House Oversight Committee who is leaving Congress this year, has turned down the opportunity to be nominated to the federal bench, Fox News has learned.

According to sources, White House Counsel Don McGahn called Gowdy twice to see if he would accept a nomination to serve as a judge on the 4th Circuit Court of Appeals, but Gowdy declined. McGahn was about to submit a list of names for the 4th Circuit openings, and thought Gowdy wanted to be considered.

It was thought to be Gowdy’s dream job, but the lawmaker has signaled he is more interested in practicing law and teaching. The 4th Circuit has two openings for judges.

Gowdy, a former federal prosecutor, was also approached about the opening by South Carolina Republican Sen. Tim Scott and Lindsey Graham. Gowdy told them he didn’t want to do it after consulting with his wife, Terri, who expressed concerns he might not be truly happy in that role.

REP. TREY GOWDY TO LEAVE CONGRESS, BECOMING LATEST-PROFILE COMMITTEE CHAIRMAN TO RETIRE

The 4th Circuit hears appeals from the nine federal district courts in Maryland, Virginia, West Virginia, North Carolina, and South Carolina and from federal administrative agencies.

Gowdy, elected to Congress in 2010, announced Wednesday that he is retiring from Congress at the end of his term, becoming the latest high-profile committee chairman to opt against re-election.

“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,” Gowdy said in a statement.

Gowdy, elected to Congress in 2010, quickly gained fame for his role in investigating Obama administration scandals on the Oversight Committee and then as the chairman of the House Select Committee on Benghazi.

The 53-year-old Gowdy, a member of the House Intelligence Committee, has been outspoken about the FBI’s investigations into 2016 Democratic presidential candidate Hillary Clinton’s email practices, as well as the Russia probe involving President Trump and his aides. Most recently, he has been a proponent of publicly releasing the House Intelligence Committee memo on alleged government surveillance abuses.

“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,” Gowdy said in a statement on Wednesday. “As I look back on my career, it is the jobs that both seek and reward fairness that are most rewarding.”

During his tenure in Congress, conservatives had unsuccessfully mounted efforts to get Gowdy to run for speaker of the House or majority leader -- efforts he rejected.