Throngs of Hong Kong residents rallied against Beijing on Tuesday in one of the largest pro-democracy demonstrations in the region’s history.

Coming on the heels of several recent clashes between the two sides, the march encapsulated both the growing anger and resentment in Hong Kong and mainland China’s refusal to cede political control.

Tens of thousands of people streamed from Hong Kong’s Victoria Park into its business district amid stifling heat. Many held banners demanding voting rights. Others carried placards decrying the Chinese government. Some could be heard chanting the revolutionary song “Do You Hear the People Sing?” from the musical “Les Miserables.”

“We don’t want communist Hong Kong,” one man’s sign read.

For hours after the march, hundreds sat in civil disobedience downtown in front of government offices. And by Wednesday morning, more than 500 of them had been arrested for unlawful assembly, including three lawmakers.

Fueling much of the turnout was an unofficial, activist-organized referendum on voting rights that ended Sunday. With more than 780,000 voting — more than a fifth of Hong Kong voters — the referendum’s success surprised even the organizers and galvanized their cause.

A thriving financial hub and former British colony, Hong Kong was returned to Chinese rule in 1997 with the promise of eventual universal suffrage. Until now, its chief executives — the top leadership post in Hong Kong — have been chosen by a largely pro-
Beijing committee.

China’s communist leaders have said that they will allow Hong Kong’s residents to vote for the chief executive beginning in 2017, but in a white paper issued last month, Chinese leaders made clear that Beijing would retain control and allow only “patriots” to be nominated for the election.

The white paper touched a nerve among many in Hong Kong, who harbor deep distrust of Beijing.

“Hong Kong people have a pretty good radar when it comes to mainland leaders. They know when someone is telling them, ‘We’re the boss,’ ” said Michael Davis, a law professor at the University of Hong Kong. “The more heavy-handed Beijing has gotten, the more they’ve alienated people and appear to have encouraged activism.”

Organizers say 510,000 people took part in the march; police gave a figure of 92,000. The estimates are the largest from both sides since 2003 (when organizers counted 500,000 and police counted 350,000) and 2004 (when organizers counted 530,000 and police counted 200,000).

Behind much of the recent democratic agitation in Hong Kong is the Occupy Central With Love and Peace movement, whose organizers have threatened to unleash civil disobedience on the financial district if Beijing does not grant authentic universal suffrage.

After Occupy Central organized the referendum, held June 20-29, its Web site for online voting was targeted by a sophisticated cyberattack. The Web site of Apple Daily, a pro-democracy Hong Kong newspaper, also came under attack.

On Monday, the Chinese government’s state council called the referendum “illegal and ineffective.”

The Global Times, a nationalistic newspaper in China affiliated with the party-run People’s Daily, has run a string of scathing editorials accusing Hong Kong’s activists of dividing the society and calling the referendum an “illegal farce,” “joke” and “game.”

Meanwhile, People’s Daily has issued its own warnings, saying Hong Kong has enjoyed more autonomy than any other Chinese city. It said this shows the “trust and support” Beijing has toward Hong Kong, but that Hong Kong must not forget that it has that power only because Beijing allows it.

Driving the unrest among many in Hong Kong is a sense that they are slowly losing control over their city. An influx of mainlanders is fueling competition for products and services, including baby formula, hospitals and schooling. There is also growing fear that Hong Kong’s values, such as democracy and freedom of speech, are beginning to bend under increasing pressure from Beijing.

In late February, three days after a demonstration by journalists and intellectuals in the region in support of press freedom, Kevin Lau Chun-to, who was fired as chief editor of the Ming Pao newspaper, was attacked by two men and stabbed six times in the back and legs.

Last month, Hong Kong news media alleged that two banks, HSBC and Standard Chartered, had pulled ads from Apple Daily, known for its criticism of Beijing, at the request of Chinese authorities. Also last month, allegations surfaced that a large bookstore chain, called Eslite, had removed books on Tibet and human rights for fear of infuriating Beijing as the company plans to expand into the mainland market.

Taking out a half-page ad in Hong Kong newspapers last week, the world’s four largest accounting firms — Ernst & Young, PricewaterhouseCoopers, Deloitte and KPMG — also voiced opposition to the Occupy Central movement. That prompted a counter-ad Monday purportedly purchased by Hong Kong employees of the four firms disagreeing with their bosses’ stance.

Organizers released the results of the referendum this week, and the proposal that garnered the most support, at 42.1 percent, rejected many of the conditions laid out by Beijing’s white paper and called for allowing the public, a nominating committee and political parties to choose candidates for chief executive.

The Hong Kong government reiterated in a statement Tuesday that such public nominations are against current regulations.

Beijing’s leaders may ultimately regret having issued the white paper, said Zhang Ming, a political science professor at Beijing’s Renmin University who is critical of China’s stance toward Hong Kong.

“It was not a wise move. It was too tough and unnecessary,” he said. “At the same time, what the radical groups are doing in Hong Kong is not good either, because they are pulling the public in opposite directions. Those in the middle are not having an impact.”

The polarizing actions of both sides have made it much harder to find what’s most needed next, he said. “Somehow, the two sides really need to find common ground.”

Xu Yangjingjing contributed to this report.