HONG KONG — Hundreds of thousands of people filled the sweltering streets of Hong Kong on Sunday in an immense protest against a government plan to allow extraditions to mainland China that culminated after midnight in clashes with the police.

The mass demonstration was one of the largest in the city’s history and a stunning display of rising fear and anger over the erosion of the civil liberties that have long set this former British colony apart from the rest of the country. Organizers said they counted more than one million on the streets, or nearly one in seven Hong Kong residents.

The protest recalled the pro-democracy Umbrella Movement five years ago, which paralyzed several of the city’s main commercial districts but failed to persuade the government to make any concessions. Since then, China’s ruling Communist Party has been gradually exerting more influence over Hong Kong.

The local authorities have rejected demands for free elections and ousted opposition lawmakers, and critics say Beijing’s supporters are chipping away at the independence of the territory’s courts and news media.