Life has been cushy in the three decades since this tiny sultanate on the island of Borneo started tapping offshore oil and gas deposits. Saturated with cash, the government has provided free university education and free health care. Loans have been interest-free. Income has been tax-free. Even the Disneyland-like amusement park here has been free.

But after years of unbridled spending, Brunei has cash-flow woes. At the root of the problem, the government says, has been the spendthrift behavior of one man--on a scale that makes technology titans in Silicon Valley appear positively pedestrian.

In a sensational lawsuit that has rocked this normally staid and secretive nation, Sultan Hassanal Bolkiah accused his younger brother, Prince Jefri Bolkiah, of squandering more than $40 billion in state funds on a variety of dubious investments while he was the country's finance minister and head of the state investment agency. Among his purchases were the Palace Hotel in New York, the Plaza Athenee hotel in Paris, the Hotel Bel-Air in Los Angeles and Asprey & Garrard, the official jeweler to the British royal family.

His personal expenditures were similarly lavish. The playboy prince reportedly blew $2.725 billion over a 10-year period--an average of $747,000 a day--buying himself 2,000 cars, 17 airplanes, several yachts, vast quantities of jewelry and more than a dozen homes.

Firing back in a court hearing earlier this month, attorneys for the prince accused the sultan of embezzling $8 billion from the government, according to a transcript of a closed hearing obtained by The Washington Post.

But late Friday night, the increasingly nasty dispute came to an abrupt end as the government announced a settlement. Jefri, according to a news release issued by the sultan, promised to return to the state "all assets such as hotels, buildings, lands, shares and other similar assets" that were purchased with funds from the state-controlled Brunei Investment Agency.

The current value of those properties is not clear, but people familiar with the case say it is likely that they are collectively worth billions of dollars less than their purchase prices. "It's unlikely they will get back anything near what was spent," said one Western diplomat here.

There also was no word on what sort of compensation the prince will receive. During the legal battle, Jefri, whose assets were frozen, had been restricted to a $300,000-a-month allowance. The prince, who has four wives and 35 children as well as a considerable transportation fleet to maintain, had sought more, arguing that his "ordinary living expenses" are at least $500,000 a month.

But Brunei's chief justice denied that request, noting that the prince has "an extremely expensive lifestyle" and that he recently spent $2,000 on new bedsheets.

The key participants in the case have made no public comments, but Jefri's supporters have argued that he was unfairly targeted by Islamic conservatives--including another brother, Prince Mohamed--who want to tighten control of the sultanate. Jefri has been stripped of his official posts, but government officials said the sultan only grudgingly took his brother to court after lengthy, behind-the-scenes negotiations failed to yield an agreement.

Although the lawsuit may be settled, Brunei's problems are not. An economic analysis commissioned by the sultan recently warned of "fundamental economic problems which threaten to undermine the prosperity . . . enjoyed by the people of Brunei."

Formally known as Brunei Darussalam, which means "abode of peace," this sleepy country of 300,000 is devoutly Muslim. Liquor, dancing and gambling are prohibited. The government is the royal family, which has been in power for the past 600 years. Since 1962, when the last sultan squelched a revolt, the country has officially been in a state of emergency. The last parliamentary elections were in 1968. There is no real opposition party, people here say, largely because the citizenry has been too coddled to want change.

For years, economists here and abroad had said that oil revenue, if properly invested, could forever sustain this nation. As recently as a few years ago, the Brunei Investment Agency, run by Jefri, had as much as $110 billion in its reserves, which it was supposed to use to find new sources of national revenue, according to people familiar with the fund.

But by last year, the value of the secretive fund had plummeted to about $40 billion. The reversal of fortune was driven partially by a drop in oil prices and the Asian financial crisis, but the biggest reasons, say people who follow Brunei's economy, have been financial mismanagement and lavish spending by the royal family.

Oil revenue has allowed the government to subsidize housing, gasoline and cars. Health care and myriad other services that people in most countries have to pay for are free, handouts that are known as "Shellfare," a reference to Royal Dutch/Shell Group, the giant petroleum corporation that pumps crude from the ground and cash into the government's coffers. The oil revenue also has paid the salaries of the estimated 60 percent of Brunei citizens who work for the government, keeping them in high-paying jobs with short work hours and perks such as interest-free car loans.

"The government, quite literally, has been spending like there is no tomorrow," said one banker, noting that since 1994, the government has run a budget deficit averaging $600 million a year.

The revenue crisis has led to rising unemployment and fewer new government jobs. Construction on several high-rise buildings and a gold-leafed hotel with eight swimming pools in Bandar Seri Begawan, the capital, have been put on hold. And the government recently announced that people would have to pay for visits to the doctor--albeit just $1--and for rides at the amusement park.

"Unless government finance is strengthened," the economic report said, "His Majesty's government will be increasingly diminished in its ability to provide security, social services and infrastructure development."

The sultan even lost the title of world's richest man--to Microsoft Corp. Chairman Bill Gates.

Now, Brunei's government is trying to encourage the development of technology companies and other efforts to develop its small private sector, which officials hope will serve as a backbone for a new, oil-independent economy. But such an effort faces stiff challenges. Brunei lacks a spirit of entrepreneurship, and its wealth has created an entitlement mentality, foreign investors say.

"People here are used to having everything handed to them," said a young architect. "It's not going to be easy to transform this welfare state into a country where people actually have to work for a living."