As a poor peasant boy 70 years ago, Sun Yaoting sacrificed his manhood to pursue the riches and power of the imperial court.

He became a eunuch of China's last dynasty, living in princely fashion at the Forbidden City as the empress' favorite attendant. He amused her, greeted her with kowtows, fed her small cakes and dreamed of the huge caches of gold amassed by other castrated courtiers.

Today, Sun is one of the last surviving eunuchs, a tragic relic of China's imperial past. His dreams far behind him, he lives out his days as a ward of the communist state, tending flowers and goldfish at the compound of Peking's bureau for the preservation of temples and monasteries.

Only two other eunuchs are said to be alive, the final trace of a feudal servant class renowned for lusting only after power. In the Ming Dynasty (1368-1644), eunuchs reportedly numbered 100,000. They were trusted palace officials who guarded the emperor's harem, managed his finances, plotted against his enemies and even commanded his armies.

Sun, at 80 the youngest of the three survivors, has lived in virtual seclusion since the last emperor was driven out of the Forbidden City in 1924. As he reviewed his unusual life nearly six decades later, he spoke with little rancor of the cruel historical twist that turned him from an intimate of the empress into a freak and a social outcast.

"Not many had a chance to speak to the empress," he said wistfully in an interview at his quarters.

When Sun was admitted in 1916 to the court of the Qing Dynasty, the old imperial life style already had begun to fade. The empire had been overthrown five years earlier, although China's new republican rulers had promised the emperor a symbolic role and permitted him to live in the palace.

The eunuch corps had shrunk to 900, and Sun, then 16, considered himself lucky to have been accepted for service. The waiting list for imperial castration was long because so many peasant families wanted their sons to become eunuchs.

Sun, at 10, endured the primitive rite that qualified commoners for court duty by eliminating any chance of leading a family clique against the Son of Heaven. Since his family was too poor to afford the services of the famous court-sanctioned "little knife Liu," his father performed the surgery.

"It was the only way out for a poor family," said Sun, still wincing from the memory. "I fainted. It took more than two months before I was able to walk again."

His first job at the palace was serving the chief eunuch. He was taught how to greet his superiors with three kneelings and nine kowtows, the deferential touching of the forehead to the ground. He learned how to load the emperor's water pipe. He was warned never to clap his hands, a ritual performed only when one of the regent's wives died.

Every evening at sunset, Sun said, a big bell would ring to signal the end of the work day and order the exit of all males from the court except for members of the imperial family and the eunuchs.

The boy emperor Pu Yi had limited himself to two wives, freeing the eunuchs from their traditional chore of managing the ruler's sexual program and administering the hundreds of concubines who filled his harem. This had been an important source of power for eunuchs, whose free access to the harem kept them informed of palace intrigue and aware of the emperor's whims.

In Sun's day, however, the work had become more pedestrian. Eunuchs cooked royal feasts, swept the marble floors, checked the accuracy of clocks, kept the tall brass urns of incense burning, balanced the palace accounts and tied the emperor's shoelaces.

As the youngest eunuch, Sun soon fell into the good graces of the teen-age empress Wan Rong, a playful girl who made her 20 courtiers join in games of hide-and-seek and drop the handkerchief. She was especially kind to Sun, he recalled, rewarding him with silver dollars to augment his monthly salary of 20 taels of silver.

Sun remembers Pu Yi as a childlike, impetuous ruler who spent his days riding an English-made bicycle through the court of buildings with gold tile roofs. Pu Yi enjoyed humiliating his eunuchs and once forced Sun to ride the bike, laughing wildly as Sun weaved and finally toppled over.

"The emperor was very unsteady in his temper," said Sun. "If a eunuch made a mistake like telling the kitchen that the emperor wanted chicken pies instead of pork, you could get punished severely."

Although palace life had grown more sedate in the last days of the empire, Sun knew of eunuchs who once had virtually run the empire, some living lives of debauchery and others leading naval expeditions. Handsome fortunes were made through kickbacks taken from concubines for arranging sexual liaisons with the emperor, helping their families obtain court favors or allowing the women to have illicit affairs with other men.

Many eunuchs took wives for the sake of appearance and some even kept their own concubines to cultivate an image of normality. Sometimes eunuchs experimented with occult arts in the hope of restoring their sexuality. Some assembled armies of concubines to stimulate what they believed was a latent ability to regenerate sexual organs.

While emperors spoke of their eunuchs as docile and loyal as gelded animals, the traumatic sexual alteration and social stigma is said to have turned most eunuchs into sadistic, superstitious and arrogant officials who specialized in spy networks and punishment of imperial enemies.

One especially cruel eunuch, whose master grew bored with beautiful young concubines, canvassed the empire for the ugliest and most deformed women, whom he pressed into service in a special chamber called the Palace of the Desirable Monsters, according to court histories.

Two of China's most powerful eunuchs -- An Dehai and Li Lianying -- curiously served a woman regent, the Dowager Empress Tzu Hsi (1835-1908), who relied on her neutered aides for support in the male-dominated court.

One of their main duties was said to be neutralizing male pretenders to the throne by keeping them sated with opium and harem life, or in emergencies, stopping them with less enjoyable methods.

When the last emperor, Pu Yi, was finally forced out of the Forbidden City in 1924, the eunuch corps, which had dwindled to 200, found itself bereft of royal protection from a society that had grown to despise the sexless power wielders, calling them "court rats."

Sun said the return to life outside the palace was painful for eunuchs, who were so confused they did not know whether to use male or female public toilets. They were taunted on the street and forced to beg for money, he recalled.

Finally, several eunuchs pooled the money they received for the sale of old court valuables and bought some land in western Peking. They built a Buddhist temple called Green Dragon and lived there in dire poverty for the next 25 years, subsisting largely on corn muffins and keeping warm by burning used coal found in refuge heaps.

In 1949, the Communists seized power in China and nationalized the eunuchs' temple. Sun and his 30 surviving colleagues were given state jobs as clerks and maintenance workers. They also were given political lessons about man's exploitation of man, he said.

In his 80th year, Sun, a tiny bent man who walks with a cane, paces the courtyard of his run-down quarters less than two miles from the "precious seat" that he gave up so much to serve long ago.

He was asked whether he had any regrets.

The old eunuch turned his head in the direction of the Forbidden City, paused and finally replied, "My happiest day was when I was transferred to the empress' chamber. Now I have nothing left. Not even her picture."