Pro-democracy candidates gained seats in Hong Kong's legislature but failed to take control of the body despite winning a large majority of the popular vote in elections Sunday. The outcome represented a setback for the campaign to persuade Beijing to allow universal suffrage here.

The democrats won 18 of the 30 council seats filled by direct elections, according to results announced Monday, but they won only seven of the other 30 seats filled by small constituencies of special interests, most of which favor candidates who support the Chinese government.

The results allowed advocates of greater democracy in this former British colony to expand their 22-member presence in the Legislative Council to 25 seats, but left them short of the majority needed to block government legislation. Democracy activists had hoped to win at least a near-majority and use it to force China's Communist leaders to open talks with them about the pace of political reform in Hong Kong.

Beijing angered the public with a decision in April that ruled out the use of direct elections to choose Hong Kong's next chief executive in 2007 and all of its legislators in 2008, and set no timetable for political reform.

"I am disappointed" with the results, said Martin Lee, one of the founders of the Democratic Party, who succeeded in fighting off a strong challenge for his seat. "It shows how unacceptable the electoral system is."

A record 1.7 million people turned out for the election, and several voting stations ran short of ballot boxes, prompting complaints from pro-democracy candidates who said many voters frustrated by long delays gave up and went home. Early Monday, the Democratic Party demanded a recount of results in one closely watched district after authorities counted fewer ballots than were distributed there. After the recount, results remained the same.

Polls earlier this year had forecast an outpouring of support for pro-democracy candidates, and as many as a half-million people marched in a demonstration on July 1 demanding universal suffrage.

But the democracy advocates stumbled with a series of campaign scandals in recent weeks. One candidate in a hotly contested district spent Election Day in a labor-reform camp on the mainland after allegedly being caught with a prostitute, and another acknowledged using public funds to rent office space in a building he owned.

Meanwhile, the Chinese government sought to shore up support for its allies in Hong Kong by bestowing new economic benefits on the territory and promoting patriotism with military parades, religious exhibitions and, most recently, a gala celebration with its Olympic medalists.

"If too many legislators advocate democracy, I don't think it would be good for Hong Kong's business environment," said Dorothy Chow, 30, an office clerk who said she voted for a slate of candidates from the largest pro-Beijing party, the Democratic Alliance for the Betterment of Hong Kong.

The alliance -- which used the slogan "Stability Is In" -- and its allies won 10 of the directly elected seats, an increase of three. The pro-business Liberal Party, which generally sides with Beijing but prompted a crisis for the government last year by withdrawing support for a controversial internal security bill, fielded its first candidates in the direct elections and also won two seats.

"I believe at least part of the population has reconsidered what their aspirations are for the future of Hong Kong," said Jasper Tsang, one of the leaders of the pro-Beijing alliance who was reelected. "A sizable proportion of the population wants to see stability, social harmony and more constructive work by the legislature."

Pollsters estimated that 60 to 67 percent of voters had cast ballots for pro-democracy candidates, possibly setting a new record for the camp. But the showing was not enough to overcome an electoral system designed to keep allies of the Chinese government in control of the legislature.

Special constituencies of businesses, industry associations and professions such as doctors or engineers choose half of the territory's 60 lawmakers, and most of them firmly favor Beijing. Eleven pro-government candidates were elected without opposition, and democracy advocates struggled to hold onto the five seats they won in 2000.

The democrats fared much better in the 30 seats filled by direct elections, but electoral rules diluted their showing in that voting, too. Hong Kong is divided into five large, multi-seat districts, and a complex system of proportional representation negotiated by the Chinese with the British before the handover in 1997 all but guarantees pro-Beijing parties a substantial share of seats.

Margaret Ng, a pro-democracy legislator in the lawyers' constituency who won reelection, warned that the large gap between popular support for the democrats and the number of seats they won would increase public frustration with Hong Kong's political system.

"This is a diabolical system, a system that was imposed on us," she said. "The legislature is supposed to reflect public sentiment, but it really doesn't."

Two prominent critics of the government, the veteran street activist Leung Kwok-hung, known as "Long Hair," and Albert Cheng, one of three popular talk-radio hosts who went off the air in May after allegedly receiving threats from people with ties to Beijing, also won election.

Advocates for greater democracy are now expected to turn their attention to the negotiations underway on procedures to choose the successor to Chief Executive Tung Chee-hwa and the next Legislative Council.

Though Beijing has ruled out universal suffrage for both elections, it has said it was willing to consider alternative plans and Tung's government has begun drafting proposals. A two-thirds vote of the legislature -- and thus the support of democrats -- would be needed to pass any proposal.

Hong Kong's chief executive, Tung Chee-hwa, right, and Woo Kwok-hing, second from right, head of the electoral commission, help open a ballot box. Martin Lee, one of the founders of the Democratic Party, follows election results at Hong Kong's vote-counting center. He won reelection.