BEIJING — When Cao downloaded the Qiangqiantong app, he certainly never expected it could ruin his life.

The 61-year-old grandfather retired from his factory job last year, and bills were piling up — rent for an apartment near his son, money for his family. It was becoming harder and harder for him to stretch his pension of about $300 a month.

So Cao invested the equivalent of $11,600 — his entire savings — with Qiangqiantong. And why not? The app claimed to offer amazing investment opportunities, with high returns and little risk.

Instead, this June, the company shut down.

Now Cao does not know whether he will ever see his money again. He has gone to the police, but they say they cannot help. He has thought about getting another job, though he doubts anyone will hire him. He has not told his wife or children and did not give his full name, so they would not find out.

“I don’t know what to do,” he said. “I can only wait.”

Cao is among the many Chinese left battered and baffled by the recent collapse of China’s peer-to-peer lending industry, or P2P, a collection of once-unregulated investment houses critics now say were little more than pyramid schemes allowed to flourish for years in China’s overheated economy.

Over the past decade, millions of investors have sunk their cash into thousands of companies like Qiangqiantong (which roughly translates to Get Rich Quick) and others with names such as Money Pig and Qianbao, or Wallet.

The promises were the same — steady growth, big dividends and a chance for investors to put financial worries behind. Investors lapped it up. It was once among the largest small-investor cash floods in the world, with as much as $200 billion riding on P2P dreams.

Some state-owned banks even helped facilitate payments, and government officials spoke of some of the P2P companies in glowing terms.

But since June, hundreds of upstart investment companies have gone bust — many falling victim to credit runs, risky bets or the same Ponzi-scheme unraveling that brought down fraudsters such as Bernie Madoff.

The rise and fall of the investment mania in China also offer a window into the wild and risky side of China’s economic boom. The money flows — creating a middle class in a generation — but regulations to protect investors and squeeze out swindlers have lagged far behind.

“There is a human and social cost to the bad behavior” of lenders, said Jeffrey Towson, professor of investment at Peking University’s Guanghua School of Management. “Managing this as the system is cleaned up will be the biggest challenge for the government.”

In the past few weeks, those defrauded in the failed investment schemes have vented their anger at the government, with protests calling for more accountability and bailouts.

It is unclear whether Chinese leaders will step in to help people recoup their money.

Authorities did little to curb the free-for-all investment atmosphere as it grew.

Online P2P sites began to spread across China about a decade ago. Initially, the companies wooed potential donors with flashy advertising campaigns on social media sites, in movie theaters and even on apartment-building elevators.

P2P was appealing for other reasons, too. State-run banks offer few investment opportunities beyond a savings account with painfully low returns, said Kellee S. Tsai, a political-science professor at the Hong Kong University of Science and Technology who studies China’s economy.

So millions of students, farmers, pensioners and factory workers turned to P2P. By 2015, an estimated 3,500 businesses were taking investor cash.

Then cracks began to show.

In 2015, nearly 1 million investors lost a collective $9 billion in a Ponzi scheme conducted by P2P lender Ezubao. Afterward, the government began to roll out some new regulations. But it moved slowly, delaying implementation of rules until June 30 of this year.

Ahead of that deadline, some P2P companies shut down without warning rather than try to comply. In response, investors began pulling their money out en masse, leading to a run on funds and the collapse of several key players.

In the past three months, more than 260 P2P lenders have been shuttered, leaving thousands of investors in a lurch, according to the website WDZJ, which collects information on the industry,

The Chinese government has become a choice target for their anger.

In early August, swindled investors from throughout the country planned a protest outside the China Banking and Insurance Regulatory Commission in Beijing to demand repayment.

The demonstration was preemptively crippled by security officials, who rounded up potential activists at their homes and workplaces. Some who arrived at the protest site were promptly forced onto buses and carted to a detention center outside the city.

Last week, China’s banking regulator publicly called for urgent measures to clean up the fiscal mess left by the failing peer-to-peer industry. It also laid out a 10-point plan to address the financial risks inherent in the industry.

The new regulations require local governments to set up “communications windows” where investors can complain. New P2P companies and platforms are strictly banned. Those that do not repay their loans will be blacklisted under China’s ­social-credit rating system.

Ning Tang, founder and chief executive of CreditEase, a majority owner of the investment firm Yirendai, expressed worry that the crackdowns will take down the entire industry, rather than only the bad actors.

If the rules are too broad, he said, it could be “winter for the industry,” he told the Reuters news agency.

“That’s not only hurting the financial system but also the real economy,” he added.

It is also unclear what the new rules might mean for the investors.

One woman, a 33-year-old from Gansu province in north-central China, invested nearly $80,000 in three platforms over the past six months on the advice of friends. The platforms have since gone bust, and she has not been able to get her money back.

So she and several other investors connected online. Together, they pooled about $7,000, enough to hire a lawyer to try to seek their money. They also began petitioning government offices, though they have not heard much in return.

Zhang, a Beijing lawyer who also did not give his full name, to protect himself and his clients, said a lawsuit is the best tool many investors have.

Right now, he has been working with a couple of clients who lost money in P2P busts. In one case, he was able to help his client get about $1 million back, but that kind of success remains extremely rare.

The Gansu woman, who spoke on the condition of anonymity because she is a civil servant and not authorized to speak to the media, knows the odds of success are low. But it is the best she can do, she said.