Zef Nikolla/Facebook, via European Pressphoto Agency

Nasdaq has blamed Facebook’s botched debut last month on flawed computers and “technical errors.”

Regulators suspect it may be something more. The Securities and Exchange Commission has opened an investigation into the exchange for its role in the initial public offering of Facebook, according to people briefed on the inquiry. Regulators are examining whether Nasdaq failed to properly test its trading systems, which broke down during the I.P.O., and whether the exchange violated rules when it rewrote computer code to jump-start trading.

The Facebook investigation comes after a broader inquiry into trading breakdowns and other problems at the nation’s largest exchanges, including two previously undisclosed cases involving Nasdaq’s archrival, the New York Stock Exchange, the people said.

The agency’s enforcement unit, which has opened more than a dozen related cases, is examining whether exchanges lack adequate controls and favor select investors.

As investor confidence in the market wanes, the worry is that missteps by the exchanges are contributing to the dissatisfaction. Since the financial crisis, investors have seen their portfolios erode, prompting them to flee stocks.

“If exchanges have technical problems, that slows capital formation and erodes the confidence,” said Senator Jack Reed, Democrat of Rhode Island, who held a hearing this week on the initial public offering process.

While none of the exchanges has been accused of any wrongdoing and the S.E.C. may never take enforcement action, the crackdown represents a significant shift. Traditionally, the agency has been relatively cozy with the industry, which is increasingly under pressure to produce profits since the exchanges became publicly traded companies.

Along with the threat of enforcement cases, the S.E.C. has stepped up its inspections of exchanges and introduced several measures to improve the safety of the markets. For example, the agency has approved proposals that would help limit volatility in specific stocks, including circuit breakers that would halt trading.

“Cases against exchanges are few and far between, and inevitably a big deal,” said Stephen J. Crimmins, a partner at the law firm K&L Gates and a former enforcement official at the S.E.C.

Facebook’s initial public offering highlights the problems facing exchanges — and how regulators are finding their responses lacking.

On May 18, its first day of trading, Facebook got off to a rocky start. Nasdaq delayed the start of trading and later flooded the market with shares, adding to investor trepidation.

Nasdaq’s lack of communication — and at times, lack of contrition — aggravated the situation, according to documents and executives, bankers and regulators. On a May 31 call with the chairwoman of the S.E.C., Mary L. Schapiro, and other officials, Nasdaq’s chief executive expressed confusion about the S.E.C.’s aggressive approach.

“We’re regulators, too,” said the chief executive, Robert Greifeld, adding “we’re all in this together.”

The Facebook debacle comes after a flurry of trading breakdowns. In March, BATS Global Markets canceled its own I.P.O., after its systems faltered. Nasdaq last year halted trading in dozens of stocks amid technical problems.

Such experiences echo the so-called flash crash. On May 6, 2010, the Dow Jones industrial average plummeted more than 700 points in minutes, before recovering shortly thereafter.

In nearly every case, companies blamed technical malfunctions. But regulators say some breakdowns may point to more fundamental issues.

The S.E.C. is also examining whether some exchanges give undue priority to high-frequency trading firms and big institutional investors through its order types and data disclosure.

The New York Stock Exchange is among the most prominent players facing scrutiny from regulators, who have opened two investigations into the Big Board, according to people briefed on the matter who spoke on the condition of anonymity because the cases are not public.

The S.E.C., the people said, is examining whether the New York exchange violated rules by distributing in-depth stock data to paying clients faster than the public received general information. The issue was first discovered in the rubble of the flash crash.

The exchange declined to comment. But people close to the exchange have attributed the problem to unintended technical shortcomings.

The S.E.C., which has penalized the Direct Edge exchange for having “weak internal controls,” is also pursuing the Chicago Board Options Exchange for not properly policing the markets.

In February, BATS Global Markets acknowledged receiving a request from the S.E.C. The agency, a person briefed on the matter said, is examining whether any collaboration between BATS and high-frequency trading firms could hinder competition.

Nasdaq represents one of the most prominent cases.

On the day of Facebook’s debut, its finance team, led by David A. Ebersman, stood on Morgan Stanley’s trading floor surrounded by scores of traders sporting white baseball caps stamped with “Facebook.” While the mood was initially festive, he was growing anxious.

The chief financial officer turned to the bankers: “Why aren’t we starting?” Nearby, a trader clutched phones to his ears, one with a call to another bank, the other to Nasdaq.

At about 11 a.m., Nasdaq said trading would begin in five minutes. After nothing happened, Nasdaq officials phoned S.E.C. trading experts to explain that everything was under control, according to a person briefed on the call.

Nasdaq’s computers were programmed to accept last-second modifications to orders of Facebook shares. When these trades kept piling in, the system reset the price over and over again. Some orders were not executed — or were placed at prices other than the opening bid of $42. Many traders, who usually receive confirmations in seconds, had no idea how many shares they held. “We were flying blind,” said one person at a market-making firm.

The S.E.C. is examining why Nasdaq lacked an action plan for navigating such a crisis, including plans to abort the I.P.O., and whether it failed to follow federal guidelines in running system tests. Nasdaq did run some 400 tests ahead of the Facebook I.P.O., and the company used the system in question for more than five years. Mr. Greifeld has publicly blamed “design flaws” in the system.

Ultimately, Nasdaq overrode the system manually, switching to a backup server. That move, too, has drawn scrutiny. Exchanges must follow their own strict trading procedures. In this case, Nasdaq changed its procedure on the fly without amending its rules. While the exchange may not have followed the letter of the law, a person close to Nasdaq said that the company had previously used the backup system with approval from regulators.

The exchange declined to comment.

Shares started trading at 11:30 a.m., sending brief applause through Morgan Stanley’s trading floor. The Facebook team, which had been hoping for a 5 to 10 percent jump from the offering price of $38, was relieved when it rose. The team headed to Teterboro Airport to fly back to California.

Then at 1:50 p.m., a second wave of confusion ripped through Wall Street. Traders saw an unexpected sell order of roughly 11 million shares. Some wondered whether a big hedge fund had dumped shares. Investors, on the fence about buying, backed off. Others sold. Within minutes, Facebook slipped $2, to roughly $40.

There was no mystery hedge fund seller. As Nasdaq started processing trades backed up in the system, those shares were dumped on the market, according to people with knowledge of the matter. About the same time, some Facebook shares that had ended up in an account at Nasdaq were also sold without warning. The move may have violated Nasdaq’s own rules, which do not explicitly allow the exchange to take a position in the shares of an I.P.O., according to one of the people.

While some analysts have pinned Facebook’s woes on Nasdaq, others have blamed the company and its bankers for being too aggressive on the size and price of the offering.

Facebook shares ended that first day at $38.23, roughly where they started.

Two days later, Mr. Greifeld called the I.P.O. “quite successful” over all and said that technical issues had not affected the price.

Facebook’s management team, which was beginning to grasp the extent of the problems, was livid. Some wondered why Nasdaq had made little effort to keep them apprised on Friday and kept them out of decision-making.

Mr. Greifeld called a senior executive, asking how the exchange could get back into its good graces. The executive erupted. “Bob,” the executive said, “You don’t understand what a hole you’re in.”

Nasdaq soon aggravated the trading woes. The exchange informed traders it might offer “financial accommodation” for claims filed on Monday. Some investors dumped shares, to prove a loss.

In the first hour of Monday trading, Facebook plunged from $38 to less than $34, swiftly wiping out billions of dollars in market value.