During the days just before Shah Mohammad Reza Pahlavi left Iran for an idefinite exile and possibly the end of his monarchy, it was his wife, Empress Farah, who propped him up and helped him make the crucial decisions, according to palace sources.

The empress, practically alone among the shah's inner circle, had perceived the approaching problems early on, but her advice was ignored, the sources said. After her counsel that the shah deal with his moderate opposition was rebuffed, they added, she later came into her own in the final days as her husband's main adviser and confidante.

"The empress has been an inspiration to the shah," a palace spokesman said the day before the monarch's departure last Tuesday. "She has been the only sane one around."

According to palace sources, the shah himself felt bitter and demoralized during the last days before his departure, especially about what he regarded as the ungrateful behavior of the Iranian people.

The 59-year-old monarch called in elderly civil servants and aides from his early years on the throne and the time of his father, Reza Shah, to ask them where he had gone wrong, the sources said. They were men who had been swept out decades earlier for warning him not to be so autocratic, and the shah had not seen any of them for 25 years, they said.

They described emotional scenes in which the shah asked them what he had done to deserve such popular wrath.

"The shah was still unable to understand why people had turned against him," one source said. "He considered himself so committed, and that he had rendered them such a great service.

He could not see that his lack of trust in people was the flaw."

After becoming thoroughly demoralized when the United States effectively gave up on him, the shah bounced back from his despair just before his departure and got a grip on himself, said a former official with palace connections.

But his attitude of resignation was such that he did not even bother to read the newspapers during those last few days. Earlier, when the papers reappeared after a two-month strike, he reportedly was furious to see himself referred to simply as "the shah" instead of by his full title. In the old days, newspapers, radio and television all dutifully used his full title: His Imperial Majesty the Shahanshah Aryamehr, or King of Kings, Light of the Aryans.

"Why are they doing such a thing to me?" he is said to have asked a senior government official at the time. The visitor reportedly replied that he had best leave the country, "because they can do much worse things to you."

The sources said Farah was an important source of moral support during those trying days, but also assumed an extended, more direct role.

"She was involved in the most important decisions," the spokesman said, adding that the empress was instrumental in encouraging formation of the civilian government under Prime Minister Shahpour Bakhtiar that allowed the shah an orderly exist under a Regency Council that would, in theory, preserve his monarchy.

"She was the only person the shah really listened to," the spokesman said. "She was his most important adviser."

A visitor who saw Farah shortly after the Nov. 5 rioting in Tehran that led to a short-lived military government said she complained that her warning of impending disaster had gone unheeded. She said she had warned her husband months earlier to listen to the religious opposition and students and try to meet their demands. By the time the government started doling out concession after concession it was too late, the visitor said.

The empress said she also had cautioned that the extravagant lifestyle of many people around the court was provoking more resentment and hostility toward the shah.

"She gave the impression that she had been seeing what was coming but that nobody was listening to her," the visitor said.

With her background as a commoner and her more outgoing nature, the source added, the empress had a better idea than the shah of what was actually happening in the country. Another source with connections to the empress said that she reportedly had been brusquely told last fall by the shah or his advisers to stay out of the political maneuvering then going on.

"Obviously she had been giving people advice," the source said. "She had been urging the shah to get hold of moderates in the opposition and make peace with them."

Nineteen years younger than the shah, Farah Diba became his third wife in December 1959 at the age of 21. The couple had met a year and a half earlier in Paris where Farah was studying architecture. Visiting the school, the shah was impressed when she brashly complained to him about a government reduction of allocations for student scholarships.

On Oct. 31, 1960, Farah gave birth to a son and heir, Crown Prince Reza, who is taking flight training and college courses in the United States.

Over the years, Farah became deeply involved in cultural affairs, sponsoring a number of projects from contruction of museums to art festivals.

In a 1978 autobiography, she described her role as helping her husband "in certain areas in which he does not have the time to get involved personally: education, health, culture, social affairs."

She added, "Politics is his special preserve, but more and more -- it's a sign of the times -- even that gets mixed up with my occupation."