JAKARTA, Indonesia — Flash floods killed at least 43 people and left hundreds of thousands homeless in Jakarta, the Indonesian capital, the authorities said on Friday, after the city’s most intense period of rainfall since record keeping began more than 20 years ago.

On Tuesday, parts of the city recorded more than a foot of rain, according to the country’s Meteorology, Climatology and Geophysics Agency. The rain persisted on Wednesday and more was predicted this week for the metro area, one of Asia’s largest urban districts and home to more than 30 million people.

Nearly 400,000 people had been displaced by Friday, according to the National Disaster Management Agency, as teams of emergency workers sought to clear flooded streets and repair downed power lines. The vast majority of the displaced were in Bekasi, the Jakarta suburb that has been hardest hit by flooding, the disaster agency said.

More than 100 rescue workers from the country’s emergency relief agency and several military units had been deployed in the capital, Budi Purnama, the operations director of National Search and Rescue Agency, said on Thursday.

Mr. Budi said the rescue workers were struggling in city streets that had been turned into rushing rivers.

“The water discharge is very fast, the current is so strong that it even pushes parked vehicles,” he said.

When Baby Hanna Siregar, a marketer who lives in Jakarta, went to sleep at her brother’s home at 3 a.m. Wednesday, everything “was still O.K.,” she said. But just three hours later, her “brother’s car was already one-third submerged.”

By Thursday, she said, she and her family were trapped. “Since then, we are not able to go anywhere,” she said. “I don’t know how much longer we are going to be stranded here.”

About 40 percent of Jakarta lies below sea level, and the authorities have tried for years to alleviate flooding. Ordinary rains can swamp neighborhoods, as illegally dug wells and climate change have caused the city to sink faster than any other big city in the world.

As a result, officials announced in 2019 that they would relocate the capital to East Kalimantan Province, on the island of Borneo.

The authorities said the extreme weather coupled with delays in flood alleviation projects were responsible for the week’s chaos.

“The rain falling on New Year’s Eve in the western and northern parts of Java was very extreme,” the meteorology agency said in a statement, referring to the Java Island, Indonesia’s most populous. “This rain is not ordinary rain.”

President Joko Widodo said in a tweet on Thursday that delays in flood control infrastructure projects since 2017 were responsible, and blamed “land acquisition” issues.