Updated at 1:25 p.m. ET

Richard Cordray, the embattled director of Consumer Financial Protection Bureau, announced Wednesday that he will leave the agency by the end of November.

"I am confident that you will continue to move forward, nurture this institution we have built together, and maintain its essential value to the American public," Cordray wrote in an email to the agency's staff.

Cordray, who has been a tough regulator of banks and other financial institutions, has been a frequent target of Republican lawmakers. Most recently, Congress killed a rule by the bureau that allowed consumers to bring class-action lawsuits against banks and credit card companies to resolve financial disputes.

Cordray was confirmed as head of the agency in 2013, nearly two years after he was nominated by President Barack Obama. The bureau's chief architect was Elizabeth Warren, currently a U.S. senator, who had also been considered a candidate for the post.

"At the CFPB, Rich Cordray forced the biggest financial institutions to return $12 billion directly to the people they cheated," Warren said in a statement Wednesday. "He held big banks accountable. He is a dedicated public servant and a tireless watchdog for American consumers — and he will be missed."

Cordray's exit leaves him free to enter the Ohio governor's race, which he is widely expected to join. The former Ohio attorney general and state treasurer is seen as a top Democratic candidate, and the filing deadline looms in February ahead of the May 2018 primary.

During a hearing in April, Rep. Jeb Hensarling, R-Texas, who chairs the House Financial Services Committee, called for Cordray to be fired.

"For conducting unlawful activities, abusing his authority, denying market participants due process, Richard Cordray should be dismissed by our president. Not only must Mr. Cordray go, but this CFPB must go as well," Hensarling said.

Cordray responded in an interview with NPR's Morning Edition: "I think that if you're going after large banks and large financial companies to try to make sure people are being treated fairly, you're going to make some enemies, and you're going to make people uncomfortable. But that's the job we're supposed to do."

Last year, the consumer protection agency ordered Wells Fargo to pay $185 million in fines and penalties for secretly opening accounts that had not been authorized by customers. Thousands of Wells Fargo employees opened the accounts so that they would get bonuses for hitting their sales targets, according to investigators.

In September, Cordray said the massive data breach at Equifax, the credit reporting firm, is an example of why it's important to have the consumer bureau in place "to hold these companies accountable for making these kind of errors and mistakes."

The Consumer Financial Protection Bureau focuses on a variety of financial entities. One new rule would require payday and auto title lenders to determine whether a borrower can afford to repay loans in full within 30 days and limit the number of times a lender can debit a borrower's account without being reauthorized to do so.

"Too often, borrowers who need quick cash end up trapped in loans they can't afford," Cordray said when the proposed regulation was announced.

Copyright 2017 NPR. To see more, visit http://www.npr.org/.