This city was dying three months ago. Constant shelling from rebel militias had closed the main roads and airport and driven thousands of peasants into town from the countryside. Five hundred refugees crowded into the city's main feeding station; some were turned away. The worst off, women and children who had walked for days to escape the fighting, died on the crumbling sidewalks and potholed streets of this colonial-era provincial capital.

Today, Malanje is no longer under siege. The sound of children's laughter has replaced the rattle of evening gunfire. The roads and airport have reopened. Refugees are returning to the countryside; meat, fruit and vegetables have reappeared at the market. Relief workers have more than enough food to feed the needy, and the number of people at the nutrition center has dwindled to about 70. Just last week, virtually everyone here turned out for the first professional soccer match played in Malanje in almost a year.

The turnabout is the result of a startling military offensive by the Angolan government, which in six weeks has reclaimed virtually all of the territory it had lost to the rebels during the previous six months. The rebels were firmly in control of nearly three-quarters of the country two months ago but now have been pushed to the southern border with Namibia and into a small triangle of hills and dense underbrush in the central highlands region just south of this city.

As Malanje and other cities have snapped back to life, the talk here has turned to something that seemed unimaginable in September: the end of over 30 years of war in Angola.

"Everywhere, people are saying that the war is finished," said Silveira Dala, who lives in Malanje and works as an interpreter for Doctors Without Borders, an international relief agency. "People just really feel that we are seeing the beginning of the end of this terrible war. Life has returned to Malanje."

The government's thunderclap of a resurgence, coupled with the defections of key rebel leaders and of the rebel movement's Cold War allies, has inspired an uncommon optimism--by turns guarded and giddy--in a country that has been at war longer than most of Angola's 11 million people have been alive.

"The rebels are clearly a much diminished force," said one Western diplomat. "The government's counterattack surprised everyone, including, I think, the government. The rebels still have a lot of men and a lot of weapons out there, and anything can happen still. But I think its safe to say that we are closer to peace now than we've ever been."

Angola has essentially been at war since 1961, when rebels began their military campaign to topple Portugal's colonial government. Fourteen years of conflict led to independence in 1975, but rival militias almost immediately plunged the country into civil war.

The internecine conflict quickly escalated into an international affair, amplified by Cold War ideologies. The Soviet Union and Cuba backed the governing Popular Movement for the Liberation of Angola (MPLA). The United States and South Africa's apartheid government supported the rebels of the National Union for the Total Independence of Angola--UNITA--and their anti-communist leader, Jonas Savimbi. Some 500,000 people have died in the fighting, according to U.N. estimates.

Since the Soviet Union's collapse, the war has deteriorated into a crude conflict over power and profits from the country's vast supply of diamonds, oil and gas. A peace treaty brokered in 1994 dissolved a year ago when the government accused Savimbi of stockpiling weapons and attacked rebel strongholds.

Using profits from diamond mines in captured territories to buy arms and fuel, the rebels knocked the government's forces back on their heels within six months. The government's meager resources were stretched even further as refugees fleeing UNITA militias poured into provincial capitals like Malanje, Huambo, Kuito and Luanda.

But a recent jump in oil prices from roughly $9 to $20 a barrel has increased the government's profits from its state-owned refineries, financing the purchase of new tanks, aircraft and munitions that have been instrumental in the government's battlefield success, military experts say.

At the same time, the outside world has pressured UNITA as never before, urging the rebels to dump Savimbi as their leader and return to the negotiating table. Growing criticism from international relief agencies led South Africa's DeBeers Corp., the world's largest buyer of diamonds, to announce in October that it would not purchase Angolan diamonds while the war continued. Angola's neighbors in southern Africa strengthened sanctions against the rebels last month, and former South African president Nelson Mandela said that Savimbi would never be welcome in that country.

Though no great admirer of the government's socialist economics, widespread corruption and alleged human rights abuses, the Clinton administration decided in 1996 to forbid the sale of munitions, fuel or other supplies to the rebels, and sided with the government in blaming UNITA for cease-fire violations.

In a strongly worded attack on Savimbi last month, a British diplomat said that the Bank of England had frozen several of Savimbi's bank accounts and appealed to UNITA to dump Savimbi and negotiate a settlement. Savimbi "is in his own context as bad as Saddam Hussein or Slobodan Milosevic," said Peter Hain, Britain's minister for Africa. "The blood of hundreds of thousands of Angolans drips from his hands."

Last week, Richard Holbrooke, U.S. ambassador to the United Nations, visited Angola and called on the Security Council to strengthen sanctions against the rebels.

The growing criticism from the international community, another Western diplomat here said, is the result of foreign powers "hedging their bets" that the government's momentum will eventually finish UNITA off and that a good relationship with President Jose Eduardo dos Santos and the ruling party will improve investment and trade opportunities. Angola accounts for about 7 percent of the oil imported by the United States, but that could easily double in peace time, U.S. officials say.

What effect the sanctions have had on UNITA's finances and weaponry so far is largely unknown. A secretive organization rigidly controlled by the spectral Savimbi, UNITA has had little contact with the outside world since the end of the Cold War.

But the combination of sanctions and military losses may well prove effective at demoralizing UNITA's soldiers. Military experts and diplomats say that UNITA rebels were persuaded to resume fighting largely on the premise that they would win broad international support and, ultimately, the war.

Several rebel officials, including Jacinto Bandua, a senior general, have defected to the government side in the past two months. Bandua, who joined UNITA in 1976, said at a government press conference last month that he had tired of Savimbi's "dictatorial manner," and accused the rebel leader of arresting several of his generals for failing to withstand government assaults. Savimbi's former bodyguard and the rebels' representative in Britain also have publicly split from the cause.

But perhaps most damaging to Savimbi's reputation are defections of family members. Savimbi's son, Araujo Domingos Sakaita, denounced his father in a newspaper interview published Nov. 2 and accused Savimbi of murdering his mother. A daughter, Airine Yondela Sakaita, has also been critical of her father.

"That was when people really started wondering if the tide had shifted and UNITA was in big trouble," said Francisco Gregoria, a former government soldier who now works for an international relief agency here. "If UNITA soldiers see that his own son has lost faith in Savimbi, what will convince them to continue fighting?"

The whereabouts of Savimbi, 65, is unknown. He has not been heard from in more than a month, and there are frequent press reports that he has fled Angola. In a press release Oct. 28, UNITA acknowledged that the government had retaken two strategic rebel-held territories, Bailundo and Andulo, in the central highlands area but said Savimbi was "well and in good health" and that the rebels have the "strength, firmness and determination to withstand the onslaught."

The head of Angola's armed forces, Gen. Joao de Matos, who acknowledged in July that government troops were being soundly beaten by UNITA, said last month that his troops were closing in on Savimbi. "We know where Savimbi is. We are tracking him. We are bombarding him every day and we are going to keep going until we capture him or kill him," he told reporters.

But the lack of either a public response from UNITA or a rebel counterattack worries some who question whether Savimbi has changed tactics and is planning guerrilla attacks that could prolong the war. With the rainy season arriving and UNITA losing tanks and heavy artillery, some security analysts believe the rebels are merely biding their time in the bush and waiting to ambush government troops.

"I'm not at all convinced that the government can finish Savimbi off very quickly," said Hannelie deBeer, an analyst with the Institute for Security Studies in South Africa.

From her bed, a blanket on the floor of an abandoned factory in Malanje, Domingas Neves, 25, said she believes differently.

Neves said she fled her village just north of Malanje with her five children in September after rebels killed her husband. Her 1-year-old daughter is severely malnourished, and they are staying at the emergency nutrition center until she can regain her strength. Neves plans to give it a month and then return to her rural home.

"I think UNITA will be gone by then," she said through an interpreter. "I grew up with this war. I have never seen UNITA beaten like this. I truly think it might be for good this time."

CAPTION: Angolan refugees fleeing civil war rest at a camp in Namibia. The conflict has claimed an estimated 500,000 lives, but many Angolans are hopeful in the wake of a government offensive that has driven the rebels out of much of the country.

CAPTION: U.S. envoy Richard C. Holbrooke, visiting displaced Angolans, has called for stronger sanctions on the rebels.