Barriers protecting Bangkok from Thailand's worst floods in half a century held firm Sunday as the government said some water drenching provinces just north of the capital has begun receding.

That fueled hopes that Bangkok, a city of 9 million, could escape unharmed. But outside the capital, thousands of people remain displaced and hungry residents are struggling to survive in half-submerged towns. On Sunday, the military rescued terrified civilians from the rooftops of flooded buildings in the swamped city of Ayutthaya, one of the country's hardest-hit.

Bangkok has averted calamity so far thanks to a complex system of flood walls, canals, dikes and underground tunnels that are helping divert vast pools of runoff south into the Gulf of Thailand. But if any of the defenses fail, floodwaters could sweep through the tense city.

Ronnarong Wong-Ngern, a bare-chested construction worker in northwestern Bangkok, said residents there still worry that things could go wrong.

"I can't sleep at night," Ronnarong, 38, told The Associated Press as he stood beside a wall of sandbags built over a canal straddling one of the capital's northernmost borders. "Whenever it rains, all the men here get up and start adding new sandbags to these walls."

Seasonal rains that drench Southeast Asia annually have been extraordinarily severe this year, killing hundreds of people across the region. Thailand has been particularly affected. Nearly 300 people have died in the country so far, while more than 200 major highways and roads have been shut, along with the main rail lines to the north.

Despite widespread fears that disaster could touch Bangkok, the city has so far been mostly untouched. Heavy rains showered the capital for much of the day Sunday, but life was otherwise normal with shopping malls open and elevated trains crisscrossing the city.

Nationwide, the government says property damage and losses could total $3 billion dollars or more. The most affected provinces are just north of Bangkok, including Ayutthaya, a former capital which is home to ancient and treasured stone temples.

An Associated Press photographer who flew over Ayutthaya on Sunday in a Thai military helicopter saw the tops of historic pagodas rising out of the water like islands.

In Ayutthaya itself, troops in patrol boats rescued people who had taken refuge on rooftops after waters burst into the Bang Pa-In Industrial Estate.

"It's very scary, it's never been like this since I was born," one of them, Kwaikai Jeunglam, told Associated Press Television News. "Last night the water wasn't this high. Last night, it rose ... this morning, it rose a lot."

Speaking to reporters earlier Sunday, Agriculture Minister Theera Wongsamut expressed confidence the worst was over -- but stopped short of saying the threat to Bangkok had passed completely.

Theera said the largest mass of runoff water flowing south from the country's heavily inundated central plains had already passed through Bangkok's Chao Phraya river and into the sea, and water levels in river would rise no higher.

Floodwaters in the central provinces of Singburi, Angthong, and Ayutthaya had also begun to recede, Theera said.

A spokesman for the government's flood relief center, Wim Rungwattanajinda, said floodwaters have decreased in Nakhon Sawan province as well. Nakhon Sawan is also in central Thailand.

Another worry -- several days of higher-than-normal tides which have slowed runoff into the Chao Phraya -- has also eased. But similarly high tides are expected again at the end of the month.

Late Saturday, Bangkok Gov. Sukhumbhand Paribatra said he was worried about barriers on the northwest side of the capital, saying they were not as strong as in other parts of Bangkok and water could flood around them and into the city from the west. But on Sunday, he said the situation was still under control.

Associated Press journalists who traveled to that area Sunday found no serious flooding in the district bordering Nonthaburi and Nokhon Pathom provinces. Canals were not overflowing and although some residents were still reinforcing sandbag walls, few were worried.

Over the last few days, government officials have voiced increasing confidence the capital would survive without major damage. On Sunday, Prime Minister Yingluck Shinawatra echoed those sentiments again, saying "I believe Bangkok will be safe."

Yingluck spoke just after presiding over a ceremony in which an armada of more than 1,000 small boats stationed in dozens of spots on the Chao Phraya turned on their engines in an effort to help propel water down the river. It wasn't immediately clear what impact the effort would have.