A red flag flies warning people of the coming tropical cyclone Mahasen by the coast of the Bay of Bengal in Chittagong, Bangladesh, on Thursday.

COX’S BAZAR, Bangladesh — Cyclone Mahasan weakened Thursday afternoon into a tropical storm and then dissipated, causing far less damage than had been feared as it passed over Bangladesh and spared Myanmar almost entirely, meteorological officials said.

At least 45 deaths related to Mahasen were reported in Bangladesh, Myanmar and Sri Lanka, but officials had prepared for a far greater storm. Bangladesh evacuated 1 million people from coastal areas and the United Nations warned that 8.2 million people could face life-threatening conditions.

The cyclone lost power as it shed huge amounts of rainfall and then veered west of its predicted path, sparing major Bangladeshi population areas, including Chittagong and the seaside resort of Cox’s Bazar, said Mohammad Shah Alam, director of the Bangladesh Meteorological Department.

Coastal regions were also spared major damage because the storm hit during low tide, which meant there was no major tidal surge, he said.

“Thank God we have been spared this time,” local government administrator Ruhul Amin said.

The storm’s impact in Myanmar’s Rakhine state, where officials were having trouble evacuating tens of thousands of displaced Rohingya people, was minimal.

“It’s all over, and we are very relieved that we didn’t have any unfortunate incident in Rakhine state due to the cyclone,” Win Myaing, Rakhine’s regional spokesman said.

In Cox’s Bazar, tens of thousands of people had fled shanty homes along the coast and packed into cyclone shelters, hotels, schools and government office buildings. But by Thursday afternoon, the sun was shining and Amin said he planned to close the shelters by the evening.

The storm’s slow movement toward Bangladesh gave the government plenty of warning to get people to safety, Amin said.

“But for the evacuation, the casualties would have been higher,” he said.

In addition, river ferries and boat services were suspended, and scores of factories near the choppy Bay of Bengal were closed. The military said it kept 22 navy ships and 19 Air Force helicopters at the ready. By Thursday night, ferry service had resumed.

A 1991 cyclone that slammed into Bangladesh from the Bay of Bengal killed an estimated 139,000 people and left millions homeless. In 2008, Myanmar’s southern delta was devastated by Cyclone Nargis, which swept away entire farming villages and killed more than 130,000 people. Both those cyclones were much more powerful than Mahasen, which hit land with maximum wind speeds of about 62 mph and quickly weakened, said Alam, the meteorological official.

By the time it hit Chittagong and Cox’s Bazar, wind speeds had plunged to 16 mph, Alam said. The storm then dissipated entirely, he said.

Bangladesh’s government said at least 10 people were killed by the storm across the nation’s vast coastal region, most either from the collapse of mud walls or hit by fallen trees.

Related heavy rains and flooding in Sri Lanka were blamed for eight deaths earlier this week.

At least eight people — and possibly many more — were killed in Myanmar as they fled the cyclone Monday night, when overcrowded boats carrying more than 100 Rohingya capsized. Only 43 people had been rescued by Thursday, and more than 50 were still missing.

Babul Akther, a Bangladeshi police official in Tekhnaf close to Myanmar border, said police there found 19 bodies Thursday in the Naaf River, which separates the two nations. He said most of the decomposing bodies were of children, and they suspect they are victims of the boats filled with Rohingya that capsized Monday.

Much attention was focused on western Myanmar because of the crowded, low-lying camps where many Rohingya refused to evacuate.

U.N. officials, hoping they would inspire greater trust, had fanned out across the area to encourage people to leave.

In Rakhine state, around 140,000 people — mostly Rohingya — have been living in the camps since last year, when two outbreaks of sectarian violence between the Muslim minority and ethnic Rakhine Buddhists forced many Rohingya from their homes.

Nearly half the displaced live in coastal areas that were considered highly vulnerable to storm surges and flooding from Cyclone Mahasen.

“Pack and leave,” a Rakhine state official, U Hla Maung, warned before the storm hit as he walked through a camp near Sittwe, the state capital. Accompanied by more than a dozen soldiers and riot police, he suggested that people living there move to a nearby railroad embankment, then left without offering help.

Some Rohingya took down their tents and hauled their belongings away in cycle-rickshaws, or carried them in bags balanced on their heads.

Ko Hla Maung, an unemployed fisherman, was among those who had not left as of Thursday morning.

“We have no safe place to move, so we’re staying here, whether the storm comes or not,” he said. “... The soldiers want to take us to a village closer to the sea, and we’re not going to do that. ... If the storm is coming, then that village will be destroyed.”