AFTER five years of stalemate, a compromise between Hong Kong's democrats and Chinese officials has paved the way for the approval of fiercely debated political reforms by the territory's legislature. This spares the local government potential embarrassment. It will allow a majority of legislators to be elected by popular vote for the first time in Hong Kong's history. For China, too, these will be uncharted waters.

Noisy demonstrations by hundreds of people outside the Legislative Council, or Legco, building in central Hong Kong suggested that the package will not end political feuding over the pace of democratic reform. The demonstrators accused the Democratic Party, the biggest pro-democracy group, of abandoning its principles by supporting the compromise. As The Economist went to press, Legco was still debating the most controversial reforms, of the next Legco election in 2012, but had approved changes to the election for the chief executive in the same year. Of Legco's 60 members only a dozen or so were expected to vote against the Legco-related motion. Objectors say the package fails to spell out how Hong Kong will eventually achieve full democracy. One Democratic Party legislator quit the party in protest.

Yet the concessions made by the Chinese and Hong Kong government are more striking. The reforms will increase the number of Legco seats to 70 in the next elections. Five of the new seats will be directly elected, representing geographical constituencies. The other five will represent district councils, which look after local issues such as cultural events and environmental projects.

Originally China had opposed any change in the equal split in Legco between geographical seats and those for “functional constituencies”, returned by business, professional and other interest groups. Members chosen by functional constituencies are mostly pro-government. Their votes, added to those of the handful of directly elected pro-government legislators, ensure that on most issues the government and its backers in Beijing get their way.

Pro-democracy politicians demand that functional constituencies be scrapped by 2020, which is when China has promised “universal suffrage” for Legco elections. China is reluctant to abolish them. But during talks with Democratic Party leaders on June 20th, a senior Chinese official agreed to the party's proposal for the five new seats reserved for district councillors to be chosen by a much bigger electorate. The candidates would be nominated by district councillors, but everyone who does not have a vote in another functional constituency (about 93% of the electorate) would be allowed to pick the winners.

Arcane and trivial though it sounds, this was a remarkable turnaround from earlier Chinese hints. Officials probably worried that if they did not concede the point, the political-reform package might be rejected by Legco. Changes in voting arrangements need the support of two-thirds of legislators, which in effect gives the pro-democracy camp a veto. In 2005 the government suffered a severe political blow when legislators turned down its first attempt at political reform.

The Democratic Party has been bitterly attacked by its ideological allies for abandoning its earlier insistence on popular elections for all seats in 2012. They say that by accepting an expanded electoral base for the district council-filled seats, the Democratic Party has implicitly endorsed the idea of functional constituencies, and made it even harder to persuade China to abolish them.

Approval of the package means Donald Tsang, Hong Kong's chief executive, no longer has to worry about leaving office in 2012 having made no progress towards greater democracy. That remains a stated goal of his and China's governments, much as China clearly hopes to load the dice against democrats. It is for Mr Tsang's successor, and new leaders who will take over in China too in 2012, to do battle with the democrats over the next steps.