SHANGHAI — Share prices in China plunged on Friday in one of the sharpest sell-offs in years, accelerating a downturn this past week in what has been, for much of this year, the world’s best-performing stock market.

China’s two major market indexes fell in tandem. The Shanghai composite fell 7.4 percent on Friday. The Shenzhen composite fell even more, dropping 7.9 percent. Share prices in Hong Kong, which is regulated separately, also weakened, dropping 1.8 percent.

Analysts had been warning for months about the risks of a stock market bubble in China, where giddy investors have driven up stock prices by purchasing shares on margin, or with money borrowed from brokers.

China’s market has been an anomaly. Even though the broader Chinese economy has been relatively weak, which is typically bad for corporate profits, share prices of many Chinese-listed companies have skyrocketed during the past year. Many traded at record valuations, often 80, 90 or 100 times their projected earnings.

The high valuations have been a boon for listed companies and their major shareholders. The market boom has also helped encourage a wave of Chinese companies that had listed in the United States to arrange stock buyouts and delist with the intention of eventually relisting in China, where stock valuations are much higher.

In the past few months, some well-known Chinese companies have announced plans to buy back shares and delist from the Nasdaq and the New York Stock Exchange, including Wuxi Pharma Tech, HomeInn Hotels and Qihoo 360, the Internet services provider, whose management is offering $9 billion to complete the buyout.

But China’s roaring stock market showed this past week how volatile prices can be, with Shenzhen’s main index falling the previous week, then rising early this past week, then tumbling again.

The latest downturn comes as the authorities move to tighten rules on buying stock with borrowed money, which is believed to be one of the key drivers of a stock market rally that has sent share prices to seven-year highs.

“This is what triggered the correction,” said Steven Sun, a Hong Kong-based analyst for HSBC. “Also, there have been controlling shareholders, significant shareholders and corporate management trying to cash out. They had been selling massively into the rally. And these are people in a better position to know the performance of their company.”

Many analysts say that the government props up the stock market as a policy move aimed at helping debt-burdened state-owned companies repair their balance sheets. A strong market also improves the financing of private entrepreneurs, which could help spur innovation.

But the government has been careful to warn about some of the risks, including the use of borrowed money, knowing that a sharp decline could hurt smaller investors.

Analysts at some major banks, including HSBC and Morgan Stanley, have been cautioning investors about the risks of the market, particularly after a big sell-off last month. Although stock prices are still up significantly from a year ago, with the Shanghai composite reaching 5,166.35, up as much as 160 percent in the past two years, there are signs that some of the most sought-after stocks are now in the doldrums.

The Shanghai composite is down about 18 percent from its June high. But in Shenzhen, the so-called ChiNext, a kind of Nasdaq-style board on the Shenzhen Stock Exchange for growth stocks, has dropped about 30 percent during the past several weeks, meaning it is already technically in a bear market.

On Friday, European markets shrugged in early trading, opening slightly down or unchanged.

Chi Lo, a senior economist covering greater China for BNP Paribas Investment Partners, said the Chinese government had promoted the growth of the stock market as a tool for financial reform, like reducing the economy’s reliance on bank lending. But he said the government grew concerned about margin lending, and that, combined with a steady stream of new companies listing their shares on the market had led to a correction in share prices.

“This is not a bad thing,” Mr. Lo said. “This is an opportunity for long-term investors to go back in. Many investors weren’t comfortable with those sky-high valuations.”