Schapiro, a longtime regulator, took over as head of the agency in January 2009, when the country was steeped in financial crisis. The chief financial regulator worked to restore trust in the agency. (Alex Wong/GETTY IMAGES)

Securities and Exchange Commission Chairman Mary L. Schapiro said Monday that she will step down in mid-December, ending a four-year tenure that began in the rough-and-tumble days of the financial crisis and came to be defined by it.

President Obama designated Elisse Walter, one of the SEC’s Democratic commissioners, as Schapiro’s replacement for now. But people familiar with the administration’s plan expect the president to nominate a permanent successor soon.

The new SEC chief will adopt an agency saved from the brink of extinction under Schapiro’s watch. When she took the job in January 2009, the agency’s reputation was in tatters. Its failure to police Wall Street or detect Bernard Madoff’s massive Ponzi scheme had critics calling for its dismantling. Even Schapiro’s detractors credit her for making the agency relevant again under the most difficult conditions in its recent history.

But unfinished work presents knotty challenges. Critics say that under Schapiro, the SEC never fully reckoned with the financial crisis or the shortcomings that created it. It failed to punish key Wall Street figures, negotiate enough meaningful settlements with the large institutions they ran or crank out most of the regulations required of it by the Dodd-Frank overhaul measure enacted in 2010.

Meanwhile, the May 2010 “flash crash” — in which high-speed computer trading accelerated a plunge in stock values — and other glitches such as the botched public offering of Facebook are raising questions about whether the SEC can keep up with the tech-savvy traders and markets it oversees. While some other countries are moving to rein in high-speed trading, the SEC has not.

Schapiro dismissed the criticism and released several pages listing the SEC’s achievements, including an overhaul of the enforcement unit, which brought a record number of actions in each of the past two years and has returned a record $4.5 billion to harmed investors since fiscal 2010.

The agency that was once on the chopping block has gained new authority from Congress, created a whistleblower program to gather tips and complaints, and engaged in one of the most active periods of rulemaking in decades, Schapiro said. “I feel great about the last four years,” she said in an interview. “I knew the most important thing I could do was steer the agency out of the most difficult period in its history, and I feel I’ve accomplished that.”

Obama lauded her record, noting in a statement that Schapiro “was fully aware of the difficulties facing the SEC and our economy as a whole. But she accepted the challenge, and today, the SEC is stronger and our financial system is safer and better able to serve the American people — thanks in large part to Mary’s hard work.”

Even one of the SEC’s most strident critics credited Schapiro for turning around the agency. Harry Markopolos, the financial sleuth who had tried for years to alert the SEC to Madoff’s Ponzi scheme, said he initially opposed her nomination because she once ran the brokerage industry’s self-regulatory body and he took her for an industry sympathizer.

“I was quickly proven wrong,” he said. “The SEC is night-and-day better than it was four short years ago. . . . It gives no free passes to anybody.”

Many Schapiro supporters say the watershed case that showed the SEC was back in action came in April 2010, when Goldman Sachs agreed to pay $550 million to settle a fraud suit brought by the agency — the largest fine the agency had ever assessed against a financial company. Other cases followed against companies involved in the financial crisis, including Countrywide, Bank of America and Citigroup.

But the courts also dealt the SEC some of its biggest setbacks.

Late last year, a federal judge in Manhattan rejected an SEC plan to settle its lawsuit against Citigroup in one of the biggest cases to emerge from the mortgage meltdown, saying the deal was too weak and failed to hold the bank accountable for wrongdoing.

More recently, critics of the Dodd-Frank act mounted a legal challenge that torpedoed an SEC rule designed to make it easier for major shareholders to remove corporate board members and nominate new ones.

That decision had a chilling effect on the pace of SEC regulation. Many of Schapiro’s critics say she let the industry steamroll over her agency. “She is not someone who relishes conflict,” said Barbara Roper, a director at the Consumer Federation of America. “That is a very fine personal quality, but it is not necessarily the quality we need in the leader of the SEC in this environment.” The battles in the courts, partisanstruggles on the five-member commission and push-back from House Republicans on the Dodd-Frank rule called for someone more thick-skinned and combative, her critics said.

And those critics are not sure they will get that leader in Walter, a close ally of Schapiro’s who has served on the commission since July 2008. The names of several other potential Schapiro successors have surfaced, including Mary J. Miller, a senior Treasury Department official.

Rumors of Schapiro’s departure had circulated for months, and many expected her to step down after the presidential election. The pressures of the job had exhausted her, people who know her said. During Thanksgiving break, surrounded by family, she decided the timing of her departure, she said.

“I have no plans at all,” she said. “I haven’t had time to think about what I want to do next.”

But if Walter wants the top job, she would have to be renominated and reconfirmed before her term expires in December 2013.

Without Schapiro, the remaining four members on the commission will be evenly split between Republicans and Democrats, creating the potential for gridlock.

Like Schapiro, Walter served at the self-regulatory body known as FINRA before joining the SEC. A lawyer by training, she was the general counsel of the Commodity Futures Trading Commission in 1994 and held various positions at the SEC before she was confirmed as commissioner.

Bartlett Naylor, a financial policy advocate at Congress Watch, describes Walter as a Schapiro clone who voted with the chairman on nearly every policy decision.

Walter declined to comment on her future plans on the commission. But she praised Schapiro as an unflappable protector of investors who has handled the pressures of the job with grace.

“I only hope that I will be able to do as well, and if I can, it will be because of all the work she’s done in the past four years,” Walter said.