PETRA, Jordan (AP) — In ancient times, Arab tribesmen dug diversion tunnels to protect their low-lying trading post of Petra against desert flash floods. More than two millennia later, an alarm system warns visitors if flood water rushes toward what has become Jordan’s main tourist attraction.

Earlier this month, the alarms were activated for the first time, said Hussein al-Hasanat of the Petra Development & Tourism Region Authority. Sirens blared minutes before a torrent fed by heavy rains approached the UNESCO World Heritage site carved into rose-hued rock face.

Hundreds of tourists were able to seek higher ground and were later evacuated, he said.

Amateur video posted online at the time showed visitors running through a steep, narrow canyon leading to the Treasury, Petra’s main draw, as guides urged them to hurry. Later, visitors were seen standing on a higher patch near the Treasury as knee-high water poured through the canyon.

Elsewhere in Jordan, such alarms are still missing. Thirty-four people were killed in flash floods in late September and early November.

The last fatal flash flood struck Petra in 1963 when 22 French tourists and a local guide were killed by rapidly rising waters. In response, Jordan’s Department of Antiquities built a dam to keep water from entering the canyon leading to the Treasury.

In 2014, the alarm system was installed as added protection, with sirens set to go off when flood water rises above a certain level.

On Nov. 9, the system was triggered for the first time, through a computer in the Petra Authority’s control room. The computer is connected to eight rain forecast systems and two water detection stations placed in the area, within 8 kilometers (5 miles) of Petra.

The network generates instant data allowing officials to measure possible danger and warn people by the time the water reaches Petra.

Omar Dajani, a meteorologist at the Arabia Weather company, said alarms should be installed in all vulnerable areas in Jordan.

He said urban sprawl has exacerbated the flood risk, which is particularly high in dry areas.

“Now towns have spread so much and many of them were not built with respect for the geography of the region, such as valleys for example, where the water has naturally caused floods for millions of years,” Dajani said.