There was once a crown prince, Djalaludin, who was being groomed as the sultan in a kingdom called Kanoman.

As he lazed in a courtyard one day beneath the broad canopy of a banyan tree, the prince spied a girl cutting across the palace grounds on her way home from school. She was 15 years his junior and the lowly daughter of a local restaurant owner, a commoner more comfortable in short skirts than finery and robes.

But the prince fell deeply in love with her.

Over the protests of his parents, the reigning sultan and queen, Djalaludin married the girl, abandoning the palace for a time and risking his chance at the throne.

Djalaludin's decision to follow his heart planted the seeds for a conflict that decades later threatens to rip the kingdom asunder. It pits his two sons, one born to the beautiful commoner, the other to a woman of royal breeding. Both young princes claim to be the 12th in a line of sultans tracing their ancestry back to the first holy men to reach Indonesian shores.

The story of their lives was assembled in interviews with members of the royal family and people close to them.

The Sultanate of Kanoman now faces not only the prospect of filial bloodshed but a threat to the very existence of a 300-year-old kingdom that many on Indonesia's main island of Java still consider the essence of their culture.

The sultanate, like other royal courts sprinkled across the Indonesian archipelago from Java and Bali to Borneo and the Spice Islands, long embodied aristocratic traditions that predate Dutch colonialism. Kanoman was a center for the arts, painting, batik, music and masked dance. Its sultan traditionally presided over Muslim rituals, serving as a unifying symbol, according to local scholars.

Like most of Indonesia's royal courts, the sultanate was stripped of its political power after the country's independence, then deprived of much of its property nearly a generation later. The leafy grounds of Kanoman became overgrown. Weeds pushed through the cobblestones and took root above on walls discolored by mold. Paint chipped and plaster crumbled, baring brick below.

Yet the throne remained a prize jealously sought.

It was 1970 when Djalaludin was first entranced by the commoner named Suherni. At age 33, the prince had been married twice before, but for her he would willingly gamble away the crown. They were wed a year later in a simple ceremony at her relatives' home outside the port city of Cirebon, she recalled. His family refused to attend.

But his mother, the queen, was determined to return her wayward son to the royal fold, members of the court now recall. She tracked him to the couple's humble nest in a quarter outside the palace and urged him to take an additional wife, allowed under Islam, one of royal descent. She proposed a distant relative.

Djalaludin acquiesced. Out of duty, he married that cousin, Sri Mulya, who was destined later to become his queen because of her royal blood. It was an extravagant affair of music and dance that drew guests from across Java. But out of love, he insisted that Suherni return to the palace with him as well.

Suherni was the first to give him a son. Their child, Saladin, was born in April 1973. Two months later, Sri Mulya also gave birth to a son, Emirudin.

The young two princes grew to be friends, playing soccer and flying kites together in the gardens. Their mothers also became close, breast-feeding each other's younger children, family members said.

But Djalaludin made no secret of whom he favored. Saladin accompanied the sultan when he would meet government officials or participate in civic events. He proved comfortable in aristocratic circles and adept at dealings with local officials. Emirudin, by contrast, was already showing signs of the diffidence that would later make him a recluse.

Still, many in the royal court assumed Emirudin would someday become the next sultan by virtue of his mother's blue blood.

Djalaludin died in late 2002, reportedly from complications of diabetes. Forty days after the sultan's death, following the traditional period of mourning, more than 100 members of the Kanoman family were summoned to the royal reception hall, according to family accounts. There, beneath the carved wood ceiling and crystal chandeliers, the late sultan's brother produced a testament that had been secretly stowed in a small black case. To a stunned audience, he declared the sultan's heir to be Saladin.

Many in the hall hooted in protest. Emirudin's partisans called the final testament a fraud, though Emirudin himself said little in public. A slight man with a dark goatee, he only rarely ventures outside the palace grounds in his used 1980 Toyota, instead letting relatives, courtiers, lawyers and royal retainers argue his case.

"According to Islam, there is no blue-blood family, no distinction between a mother who has a royal background and one who does not. According to Islam, all wives should be equal," said Saladin, chain-smoking Marlboros from the pack he keeps in his T-shirt pocket. The late sultan's wishes must be honored, he insisted.

But one evening in March 2003, Saladin donned his royal black jacket with gold trim and had himself installed as sultan. The next morning, Emirudin put on similar attire and, despite efforts by his brother's loyalists to disrupt the ceremony, was likewise declared sultan.

Yet neither could rightfully claim the throne. Neither had yet acquired the famed sacred dagger of the Kanoman court, explained the late sultan's brother, Prince Imamudin, 50, who confided that he had locked away the heirloom and other royal weapons until the dispute was resolved.

"Both sides have supporters, and they're ready to fight," said Imamudin. "I'm waiting for a miracle from God and praying we can solve this without violence."

Until early last month, an uneasy truce prevailed inside the palace. Neither prince moved into the sultan's quarters, still occupied by Sri Mulya, but instead kept living with their immediate families under the same roof in the stately white building inhabited over the centuries by royal offspring. Only a pair of heavy green doors separated the rivals.

Yet fear invaded the inner sanctum. Intimidated by Emirudin's superior supporters within the court, Saladin began to counsel his visitors to bypass the main gates, instructing them to slip onto the grounds through a back alley that winds through an adjacent neighborhood.

During the standoff, the palace continued its decline. The electric company threatened to turn off the power for non-payment and some phone service was suspended, royal family members reported. Sheep grazed in front of the royal apartments.

On June 6, Emirudin issued a decree expelling Saladin and his immediate family, including his aging mother, Suherni. Saladin refused to budge, vowing to die first.

The people of Cirebon warned that the Kanoman court is ominously reprising a dispute that almost destroyed the sultanate during colonial times, when the son of the sixth sultan secretly took up with the daughter of a Dutch official. Years later, when the couple's son was about to be crowned, the royal court erupted in protest, ultimately securing the throne for the son of another wife with royal blood.

Imamudin, Djalaludin's brother, recalled that his ancestors had prophesied a repetition of this excruciating history.

"They predicted that one day a thousand pains would merge into one, and what's happening now reflects that," Imamudin said. "My ancestors also said that after Kanoman overcomes this problem, we will regain our glory again."

But he added with a melancholy smile, "I don't know how."