BAKU, Azerbaijan, Oct. 22 - On the morning of Oct. 20, Azerbaijan's health minister, one of this oil nation's most powerful men, attended a ceremony at a tuberculosis clinic here. Next he visited a dental center.

Then the minister, Ali Insanov, returned to his office, where minutes later one of his aides tried to phone him. But Mr. Insanov was not there. He had just been fired. The next day he was arrested by the M.N.S., the local successor to the Soviet K.G.B., and accused of involvement in a coup plot.

Mr. Insanov's fall - from oligarch in the presidential cabinet to detainee accused of armed palace intrigue - was one of several from the top of Azerbaijan's government and business circles in recent days. The former economic development minister is also under arrest. At least a half-dozen other firings have dominated the government-controlled news.

A purge was afoot in Azerbaijan before parliamentary elections on Nov. 6. The administration of the young President Ilham Aliyev - who on Oct. 18 insisted in an interview with four Western journalists that his government was stable and under his control - is facing its most difficult test to date.

Fourteen years after breaking from Moscow's rule, and 11 years after the Aliyev family took power in a coup of its own, Azerbaijan is a secular Muslim oil state on the verge of a new economic boom.

But as it accelerates toward elections, pointed questions remain. Is it stable? Will it run a free and fair vote? Is talk of a coup rooted in fact, or a distraction as Mr. Aliyev tries to tighten his grip?

No one outside the government seems to know. "Azerbaijan has made a state, which is no small achievement," Assistant Secretary of State Daniel Fried said in a speech here the day Mr. Insanov was fired. "But what sort?"

The signs are mixed. Mr. Aliyev replaced his father as president in 2003 after an election marred by vote rigging and widespread fraud. His victory was certified not with the approval of international monitors, but by police beatings of protesters.

The inauguration marked the first father-son transfer of presidential power in a post-Soviet country and was used by critics as validation that Azerbaijan was little more than a tribal state beneath a veneer of rule of law.

Two years on, the new president has defied the darkest expectations. He pushed through a few reforms, including an anticorruption law, and developed a strategy for the State Oil Fund, a pool of money from oil revenues that will earmark huge sums to repair and build public works and alleviate poverty.

A poll conducted in June by the International Republican Institute shows that Azerbaijanis have many concerns - corruption, health care, living conditions and more - but a majority express optimism, a feeling particularly noticeable among the young.

Mr. Aliyev has also followed his father's course and steered Azerbaijan close to the United States, allowing improvement of a former Soviet airfield in Nasosnaya, north of Baku, that promises to give the Americans more flexibility to move troops, air power or logistics through the region. He has maintained a troop presence in Iraq.

He also holds what critics call two trump cards: gas and oil.

Azerbaijan and the Caspian Sea have vast hydrocarbon resources. Geography strengthens Mr. Aliyev's hand. To his south is Iran, to his north, Russia - nations not seen in Western capitals as reliable energy partners.

In a world growing parched for oil, Azerbaijan is the submerged end of a straw. It is the opening of a corridor that extends west to Georgia and Turkey, through which oil and gas can flow to Western markets, bypassing countries less open to Western collaboration. Pipelines for both commodities are nearing completion. By next year exports are projected to increase, then soar.

The nation's relationship with the United States has put the Bush administration in a thorny spot. Two American foreign policy objectives, a quest for secure energy sources and the advance of democracy, could come into conflict in one man: Ilham Aliyev.

This spring as a small opposition showed signs of trying to replicate the pro-democracy revolutions in Georgia, Ukraine and Kyrgyzstan, Mr. Aliyev, under Western prodding, ordered electoral reform.

Among many changes, television time was granted to opposition and independent candidates. Voter lists were opened to greater public review. More than 2,000 candidates registered to run for the 125-seat Parliament.

The changes were welcomed as a sign that Mr. Aliyev was experimenting with political pluralism. "They had a pretty good record of trying to hold a good election, a better election," the American ambassador, Reno Harnish III, said in an interview.

But by summer, amid complaints that election officials were not complying with the order, praise turned to measured criticism. And lately, as unauthorized opposition rallies have been dispersed by police officers with clubs, criticism has mounted, from sources including the Organization for Security and Cooperation in Europe, which is monitoring the election.

"Our constitution says we are a law-based democracy," said Gabil Guseynli, a deputy leader of Musavat, part of an opposition bloc, Azadliq. "But in practice this country is a semifeudal, clan-based state, a mafia. And it will use violence to have its way."

[Mr. Aliyev bowed to foreign pressure on Oct. 25 and said that indelible ink would be applied to voters' fingers and that independent foreign organizations could monitor the election. Both were Western recommendations for limiting fraud that he had resisted.]

Mr. Aliyev's government has also expended credibility by claiming that protesters throw stones or carry iron bars. Journalists and diplomats, who monitor the rallies, report no such thing. "I have no evidence whatsoever that the opposition has used stones or iron bats," said Maurizio Pavesi, the European security organization's ambassador.

Aside from drawing headlines, Azadliq's influence is hard to measure. It is fielding 125 candidates, one for each parliamentary district. But while it claims to have mustered more than 30,000 people at rallies, United States government estimates have ranged from 12,000 to 16,000. Some rallies have drawn hundreds.

Mr. Aliyev dismisses the bloc's relevance, and even its name, which means freedom. "What kind of freedom?" he said. "Azerbaijan is a free country."

That characterization is not widely held. Freedom House, an independent human rights group based in Washington, ranks Azerbaijan low on its index of political rights and civil liberties. It notes that there has not been a clean election here since the Aliyevs occupied the presidential suite.

One result of the Aliyev hold on power is unmistakable: the emergence of a hybrid class of post-Communist superrich. Not merely insiders, the elite are the government itself, the minister multimillionaires.

In April the weekly news magazine Hesabat concluded that nine of Azerbaijan's 10 wealthiest men were in the government. No. 1, by its estimate, heads the State Customs Committee. No. 3 is the nation's top police official, whose troops have been beating protesters with batons. No. 4 was Mr. Insanov, the health minister now under arrest.

The implications of corruption are self-evident. And the crackdown on members of this usually protected class has been variously interpreted as a sign that Mr. Aliyev is strong or weak, that he is crushing the old guard or removing a reform camp.

The United States has withheld public judgment, although it has not seconded the government claim that a bloody palace uprising is in the air. "I do not put much credence in this idea of an armed coup d'état," Ambassador Harnish said.