King Fahd, the absolutist monarch of Saudi Arabia who died yesterday after 23 years on the throne, guided his desert kingdom through sharp upheavals in the oil market, sweeping regional wars and the incessant, high-stakes scrimmage between Islamic tradition and breakneck modernization.

The king, whose reign began in 1982, was hospitalized with acute pneumonia in May, according to news agency reports, and the daily affairs of state had been handled by the crown prince, Abdullah, since the king suffered the first of a series of strokes in 1995. According to the monarch's Web site, he was 82.

King Fahd's years leading the kingdom were bracketed by strident challenges to the rule of the Saud dynasty, starting with the takeover of the Kaaba in Mecca, the holiest site in Islam, in 1979 by an extremist named Juhayman to a series of violent bombings in the kingdom that started in May 2003.

Although King Fahd was incapacitated by a stroke and by what was rumored in the diplomatic community to be Alzheimer's by the time Osama bin Laden's followers began their bloody bombing campaign, his response to the earlier violent challenges set the tone for the way the royal tribe responded to the accusations that it was insufficiently devout to maintain its control over the two holiest mosques in Islam.

King Fahd assumed the title Custodian of the Two Holy Mosques and although Juhayman and his followers were executed, the agenda pushed by the most conservative Islamic factions in the kingdom, ranging from vastly expanding the amount of theology taught in all schools to curbing the expanding role of women, was quietly adopted. Overseas, Saudi Arabia under his watch poured millions into financing the construction of schools, mosques and charitable organizations to spread conservative Wahhabi doctrine, which in its most radical form considers non-Muslims the enemy.

Starting with the realization that 15 of the 19 hijackers involved in the Sept. 11, 2001, attacks against the United States were Saudi followers of Mr. bin Laden, but particularly after the bombings against targets started in the kingdom, members of the ruling family grudgingly acknowledged that some of what they had financed was fomenting the very extremism seeking to undermine their rule. Coming under increasing pressure from the United States, the family began putting charitable and other organizations under its direct supervision and sought to root out terrorist cells within the country.

King Fahd bin Abdel Aziz al-Saud, the fifth Saudi sovereign, transcended his early reputation as the playboy prince to become a leader of Arab states in the Persian Gulf region, a friend to the United States when that was not always easy. King Fahd was overweight and diabetic, and had arthritis, gallbladder surgery and a blood clot in his eye. He used a cane or wheelchair. His brother, Prince Abdullah, the crown prince, ultimately assumed virtually all executive responsibilities.

Over all, King Fahd's reign, which in effect began with the long illness of his predecessor, King Khalid, was characterized by immense change.

He oversaw the exploitation of the kingdom's oil wealth and the expansion of its private sector, and he sent a generation of Saudis to be educated in the West. He let hundreds of thousands of American troops be based in Saudi Arabia during the first war against Iraq despite heated criticism from other Arab countries.

The king's influence was wide-ranging. He helped the Reagan administration orchestrate and finance its complicated, illegal operation to sell arms to Iran while aiding Nicaraguan rebels. He gave hundreds of millions of dollars to Palestinians fighting Israel and established religious schools, some of which have been described as breeders of terrorists, throughout the Islamic world.

The power and prestige of controlling the world's biggest supply of oil, a quarter of the planet's reserves, spoke for itself. But depressed petroleum prices during much of King Fahd's reign engendered economic pressures unthinkable during the high-flying 1970's. As population surged and employment opportunities dwindled, per capita income sank to a third of what it had been at King Fahd's coronation.

The king nonetheless used his ability to pump more oil almost at will as a damper on oil prices so as not to damage the world economy. But he worried when prices fell too low to pay the kingdom's bills, and in 1986 he fired his oil minister, Ahmed Zaki Yamani, for allowing crude prices to fall to $10 a barrel from $30.

King Fahd in 1986 boldly declared his other source of power by appointing himself Custodian of the Two Holy Mosques, referring to the Saudi cities of Mecca and Medina. But it was exactly this religious role that was most challenged during the latter part of his reign as Islamic conservatives derided the royal family as corrupt and the government's closeness to the United States as near satanic.

King Fahd's Saud family has ruled since 1932, when his father, King Abdel Aziz al-Saud, formed what was actually the family's third kingdom on the Arabian Peninsula.

Each time, beginning in the mid-18th century, the Sauds claimed religious authority as legitimacy for their rule. This derived from their alliance with the Wahhabi sect of Muslims, led by the al-Sheik family. In return for the endorsement of the ultrastrict Wahhabis, the Sauds act as their protectors and enforcers.

But the resultant stability had a price. King Fahd could pursue modernization goals, like educating more women, only to the extent that they did not provoke his religious base.

Moreover, he owed clerics policies they truly liked. Those included the development of universities that taught little beyond Islamic doctrine and ended up spewing thousands of theology students into a cramped labor market. The conservatives applauded his support of Muslims fighting the Soviets in Afghanistan, but the policy ended up fostering development of a radical current close to Mr. bin Laden's positions.

The challenge has been to create farms and skyscrapers in the desert, while still allowing Wahhabi enforcers to wander in public places with sticks to enforce Islamic law in matters like women's dress. Even as Saudi Arabia became a regional superpower on the strength of billions of dollars in arms purchases from the United States, conservatives criticized that dependency.

The State Department, the British Foreign Office and nongovernmental human rights monitors, meanwhile, persistently criticized Saudi Arabia's treatment of non-Muslims, women and prisoners.

Where once there were only Bedouin, the desert wanderers, King Fahd had to balance powerful constituencies. Those included a new technocratic middle class, about 7,000 princes, a legion of foreign workers and some Bedouin.

It sometimes added up to contradictory policies: Fahd was a champion of educating women from the time he was selected as the kingdom's first education minister in 1953, but only in his last years, under considerable Western pressures, did he make serious efforts to get them jobs.

Beginning in 1992, King Fahd instituted reforms in government to create a consultative council to advise royalty, decentralize some powers and widen the pool of candidates eligible to become king. But his absolute powers remained absolute, and he took pains to emphasize that the reforms were in no way a move toward Western-style democracy, but rather a reflection of the Koran.

He made no attempt to hide his status as one of the world's richest men. Even when following the traditional Arab passion of visiting the desert, he made the trip in a fleet of 18-wheel Mercedes trucks. In "The Saudis: Inside the Desert Kingdom" (Norton, 1987), Sandra Mackey said he had "built one elaborate palace after another," including an exact replica of the White House. (He never moved in to avoid the political repercussions of a Saudi king imitating an American president.)

In "The Arabs" (Random House, 1987), David Lamb reported that King Fahd employed the Washington artist who designed the floating space city in "Star Trek" to refurbish his Boeing 707 with gold-plated hardware, a three-story elevator and plastic chandeliers. His yacht was the size of a luxury liner.

Fahd bin Abdel Aziz al-Saud was born in Riyadh in 1923, according to his official Web site (http://www.kingfahdbinabdulaziz.com/). His mother, Hassa bint Ahmed al-Sudairi, was the most favored of his father's many wives and came from the powerful Sudairi clan. King Abdel Aziz married at least three Sudairi women, including Hassa, as well as 14 women from other clans. He consolidated his kingdom through such intertribal marriages.

King Fahd and his six younger full brothers were often called the Sudairi Seven, and became the strongest force in Saudi economic and political life, from oil to defense to national security. The seven were a close-knit group and met weekly, often at the home of Lulu, their eldest full sister.

Fahd, whose name means jaguar or leopard, was a favorite among King Abdel Aziz's 45 sons. The father called the son a "fox, rather than a jaguar," and taught him to ride, shoot straight and speak the truth.

Dr. Rashad Pharaon, once personal physician to King Abdel Aziz, compared Fahd with his brothers, saying he came "nearest to his father in outlook and general qualities - wisdom, ambition and the willpower to achieve those objectives for which the Saudi house stands."

Still, King Abdel Aziz was strict. In an interview in the early 1970's, then Prince Fahd recalled the time his father locked him in a room for more than two hours because he had had a fight with a neighbor's son. The king knew the other boy had provoked the quarrel, but wanted to show impartiality, Fahd said.

Prince Fahd attended what was called the palace school with other princes and studied Islamic history and religion, traditional politics, the Arabic language and desert lore. As a teenager, he liked waiting outside his father's office so he could slip inside when advisers were summoned. Eventually, at his mother's urging, the king made Fahd a member of his advisory board.

In 1945, his father sent him to the founding convention of the United Nations in San Francisco, where he became enamored with America. His first governmental post was as a regional governor.

When King Abdel Aziz died in 1953, his eldest surviving son, Saud, became king, and his second son, Faisal, was declared heir apparent. The new king appointed Fahd education minister. Fahd used the new gusher of oil revenues to build hundreds of secondary schools and numerous universities. In 1962, he was promoted to interior minister.

In 1964, King Saud was deposed and Prince Faisal became king. In 1967, King Faisal made Fahd second deputy prime minister, greatly increasing his powers.

Prince Fahd began to develop a reputation for moderation, and was reported by The New York Times and The Washington Post to have initially opposed the 1973-74 Arab oil embargo.

In 1975, King Faisal was assassinated by a nephew, and another half brother, Khalid, came to the throne. The new king quickly appointed Fahd crown prince, putting him next in the line of succession. The royal family chose him despite his reputation for high living.

Whether reality or rumor, many press accounts claimed that then Prince Fahd drank alcohol, enjoyed the company of European women and once lost $6 million gambling in Monte Carlo. In 1974, he spent the holy month of Ramadan in Europe, offending conservative Muslims.

In their book, "The House of Saud," (Holt, Rinehart and Winston, 1982) David Holden and Richard Johns said the Saudis tried to pass off these stories as a product of Zionist malice. They were insufficient to stop Prince Fahd's accession. They wrote, "It was difficult to dispute that by experience, capacity and stature Fahd was the best man to become chief executive under the new king, who, it was assumed, would be little more than a figurehead."

Still, Ms. Mackey in her book wrote that King Fahd's rakish reputation "all but fatally tarnished" him. She said many Saudis regarded him as "a high-living captive of the West."

But he was capable of bouts of furious work. Reuters reported in 1998 that his ministers complained of being summoned to sudden meetings with midnight phone calls.

After the Soviet Union invaded Afghanistan in 1979, King Fahd joined with the United States to aid Afghans fighting the Russians. Hume Horan, a former United States ambassador to Saudi Arabia, wrote in a 2004 article for the American Enterprise Institute that William J. Casey, then director of central intelligence, visited the king in 1987.

The American brought a shiny, detailed Kalashnikov rifle. Its stock featured a brass plaque saying that the weapon had been taken from the body of a Russian officer.

"Mr. Casey might as well have been giving the keys to the Kingdom of God itself," Mr. Horan wrote. "The king rose, flourished the weapon, and struck a martial pose."

King Fahd often showed agility in dealing with complex issues. For example, several times in the 1980's and 1990's he suggested that he might recognize Israel if it made sufficient territorial concessions. Other Arab countries, and Saudi conservatives, were sharply dismissive.

When Iraq invaded Kuwait in August 1990, King Fahd faced a difficult problem. During the war between Iraq and Iran in the 1980's, Saudi Arabia had given Iraq $25 billion in aid. The king first urged negotiations to encourage Iraq to retreat.

Dick Cheney, the defense secretary at the time, visited the king to make the case that Saudi Arabia stood a good chance of being Iraq's next victim. He displayed satellite photos of Iraqi missiles aimed at Saudi Arabia and described other threats.

The king huddled with his advisers, speaking in Arabic, Michael R. Gordon, a Times correspondent, and Bernard E. Trainor, who has worked as a military analyst for The Times, wrote in their book, "The Generals' War: The Inside Story of the Conflict in the Gulf" (Little, Brown, 1995). The authors said the king won over his doubters by pointing out that the Kuwaitis who had fled had been put up in luxury hotels in Saudi Arabia. He asked what country would put up the Saudis in their hotels.

Saudi Arabia allowed the United States to station troops in the kingdom. Judith Miller, in her book "God Has 99 Names" (Simon & Schuster, 1996), said the king built a consensus for the controversial action partly by persuading one of the country's most respected religious scholars, Sheik Bin Baz, to issue an edict to approve the use of force to evict Iraq.

But Ms. Miller, who is a reporter for The New York Times, wrote that the king was disappointed that the United States ended hostilities before Saddam Hussein was destroyed. She said the disgruntled Saudis briefly prolonged the war by delaying translation of the surrender document.