A proud China reclaimed control over the prosperous city of Hong Kong today, handing Beijing's Communist leaders the tricky task of managing one of the world's most sophisticated, modern economies -- and 6 million people who have had a taste of democracy.

The historic handover ceremony, ending 156 years of British rule, was the emotional and dramatic climax of a long day and night of pageantry and protest. There were bagpipers and Chinese lion dancers, all-night parties and brilliant fireworks over the harbor. There were noisy demonstrations, which the city's new Chinese rulers made no attempt to impede. And there were more than a few poignant symbols that the city's colonial era has finally come to an end, leaving Hong Kong facing an uncertain future as the richest, freest city in China.

The transfer of sovereignty took place in a newly completed waterfront complex, on a stage draped in red. British and Chinese military bands played martial music, and then Britain's Prince Charles paid a brief and moving tribute to Hong Kong's economic success. "We shall not forget you," he said, his voice and manner subdued, "and we shall watch with closest interest as you embark on this new era of your remarkable history."

Then the Union Jack was lowered for the last time, to the strains of "God Save the Queen," reaching the bottom of the flagpole at the stroke of midnight. Immediately, on another flagpole on the other side of the stage, China's red banner with five gold stars was hoisted while the band played the Chinese national anthem.

Chinese President Jiang Zemin, the first head of state from the mainland to set foot here in all of Hong Kong's years as a colony, then told the assembled guests and an international television audience: "July 1, 1997, will go down in the annals of history as a day that merits eternal memory."

"I wish to extend my cordial greetings and best wishes to the 6 million or more Hong Kong compatriots who have now returned to the embrace of the motherland," Jiang said. Measuring his words, he said the new Chinese-run territory "shall gradually develop a democratic system that suits Hong Kong's reality."

After the ceremony, which lasted less than an hour, Prince Charles and Chris Patten, the 28th and last British governor of Hong Kong, left the hall and boarded the royal yacht Britannia, moored at Victoria Harbor. The British had arrived by sea and departed by sea, sailing away into history and opening a new chapter in Hong Kong's turbulent history.

Patten left the hall with his head bowed low, and without the ritualistic round of handshakes for the Chinese leaders who in the past had dubbed him "a prostitute for a thousand generations" for his promotion of democratic reforms in Hong Kong.

A threatened confrontation on the streets failed to materialize when democracy activists were allowed to stage their rallies and marches with no police interference.

One group of protesters marched around the domed Legislative Council chambers carrying candles, while members of the popular Democratic Party appeared on the chambers' outdoor balcony for a defiant pro-democracy protest. But the rallies passed peacefully as police stood calmly, even jovially, on the sidelines.

Within an hour after assuming control, China swore in Tung Chee-hwa, a Shanghai-born shipping tycoon who favors order and stability over accelerated democracy, as Hong Kong's first chief executive under Chinese rule. Tung thanked Hong Kong's new rulers for granting this territory the "high degree of autonomy" under an untested formula known as "one country, two systems."

"We will make it work," Tung pledged.

Also sworn in were the 60 members of China's appointed provisional legislature for Hong Kong. Secretary of State Madeleine K. Albright skipped the swearing-in, as a show of Washington's protest against Beijing's move to dismiss the elected Legislative Council and install the appointed lawmakers, pending elections to be held within a year.

The appointed body met immediately after being sworn in and approved a raft of new measures that will significantly alter the rules of political protest here. All groups must now register with the government and can be banned on national security grounds, protesters must now get police permission to hold rallies, and burning the Chinese or local Hong Kong flag now is a crime punishable by imprisonment and a hefty fine.

All of these laws already had been debated and passed by the appointed legislature in meetings that were held across the border in southern China.

Meanwhile, the elected legislators being forced out of office by Beijing held a defiant rally from the balcony of the Legislative Council chambers.

Democratic Party leader Martin Lee told about 1,500 supporters at the rally that today is "the most glorious day for all Chinese people in every corner of the world," but added, "Why is it our leaders in China cannot give us more democracy? Why do they take away the democracy we fought so hard to win?"

Chinese authorities, who do not tolerate such street protests on the mainland, made no move to obstruct the rally. They did move quickly, however, to demonstrate China's sovereignty over the territory. Even before the official midnight handover, about 500 soldiers of the People's Liberation Army had crossed the border, as an advance unit for 4,000 more troops who arrived by land, sea and air.

Hong Kong's 6.4 million people watched the day's dramatically unfolding events in their living rooms, in bars and on television in hotel ballrooms and clubhouses. From the crowded tenements of Kowloon to the trendy bars of Wanchai and Lan Kwai Fong, all of Hong Kong seemed to be captivated by this turning point. Many people were celebrating, but many others expressed doubt and worry over whether this affluent territory can maintain its freedoms and Western way of life.

From the early-morning hours Monday, which had been declared the start of a three-day national holiday, it was clear that Hong Kong was witnessing a dramatic and pivotal moment in its often tumultuous history.

A large crowd had been keeping vigil on the street outside the ornate governor's mansion known simply as Government House, hoping for a last glimpse of its final British occupants, Patten and his wife, Lavender, or his weekend house guest, the Prince of Wales.

Not far away, another large crowd gathered outside a government office building to watch workmen on scaffolding trying to remove a royal British crest from its lofty position above the doorway.

Skyscrapers were illuminated with festive bright lights, some spelling out slogans welcoming the new era. Stores displayed red banners and flashy window displays. Loudspeakers on buildings played Chinese martial music downtown and near the convention center, the site of the handover ceremony. Local television stations devoted full-time coverage to the days' events. Taxicab antennae sprouted Hong Kong's new flag, a five-petal bauhinia flower on a red backdrop.

At midnight, police replaced the crown insignia on their uniforms and caps with a new insignia featuring the bauhinia.

Scores of high-level international dignitaries were on hand to witness this unusual transfer of sovereignty. Besides Albright, there was U.N. Secretary General Kofi Annan and dozens of foreign ministers. Also in the audience, with a premier position on stage for the handover ceremony, was Margaret Thatcher, who, as British prime minister in 1984, concluded the agreement with the late Chinese leader Deng Xiaoping that culminated in today's handover and the promise that Hong Kong's system will remain unchanged for 50 years.

The transition here also was being watched warily across the Taiwan Strait, where Taiwanese know that with Hong Kong safely returned to Chinese sovereignty, Beijing's Communist leaders will turn their attention to regaining control over the island China considers a renegade province. In a statement, Taiwan's government urged Beijing today to keep its promise to maintain Hong Kong's autonomous system and way of life.

The Hong Kong that China now controls is a vastly different place from the "barren rock" that the British foreign secretary, Lord Palmerston, described in 1841.

With just a little over 400 square miles of land, Hong Kong is the world's eighth-largest trading economy. It is the world's fourth-largest foreign investor and the seventh-largest holder of foreign exchange reserves.

Its stock market is the second-largest in Asia. Its port, in terms of yearly volume shipped, surpasses Singapore and Rotterdam. One in 10 Hong Kong residents carries a cellular telephone.

The typical Hong Kong resident now makes about $25,000 a year; in China, the average annual income is between $500 and $800.

Gordon Wu, a local tycoon who builds highways and hotels in China, said the difference between the levels of development in Hong Kong and China today is "like France and Bulgaria. In 50 years, it might be like France and Spain.

"It's a meshing in of two very divergent systems," Wu said. "Fortunately, they're coming around to our way -- and they're giving us 50 years." CAPTION: THE NEW HONG KONG

The new Special Administrative Region of Hong Kong will exercise a high degree of autonomy and enjoy executive, legislative and independent judicial power. Only defense and foreign affairs will be the prerogative of Beijing. Here are some specifics that apply under the Basic Law, negotiated with Britain, the former colonial power: * Hong Kong issues its own passports and determines its own visa regulations. Americans and citizens of most other countries do not require a visa to visit Hong Kong. * British citizens, who previously could move to Hong Kong and work there without permits, now need a work permit like everyone else. * The Hong Kong dollar continues to be the region's currency. Only coins bearing the image of the queen are being changed. * Street names and names of buildings remain unchanged for now. However, officials have said that any names with obvious colonial allusions may change later. * Hong Kong courts have jurisdiction over all cases except for acts of state such as defense and foreign affairs. CAPTION: Members of Britain's Royal Marines take down the Union Jack for the last time at a farewell ceremony a few hours before the formal handover. CAPTION: Hong Kong Chief Executive Tung Chee-hwa, right, greets Chinese President Jiang Zemin. CAPTION: Prince Charles and Chinese President Jiang Zemin watch the Chinese flag being brought into the convention hall for the handover ceremony. "We shall not forget you," the prince told Hong Kong's people. CAPTION: Members of Hong Kong's Royal Gurkha Rifle Battalion stand watch. CAPTION: Secretary of State Albright finds her seat for the handover ceremony. To audiences in Hong Kong, she spoke of "multifaceted relationship" with China.