BEBA VECHE, Romania — Romanian border police officer Marius Stuparu is driving through pouring rain in an SUV, monitoring for any sign of migrants trying to enter the country from Serbia and Hungary.

While Hungary has erected razor-wire fences on its borders to try to keep out migrants, Romania is relying on manpower backed by technology for border control in a region stretching from Calafat in the southwest to further north in Beba Veche.

Border guards told The Associated Press this month they are using helicopters and boat patrols on the Danube River, heat-sensitive equipment, cameras on watch towers and devices used to detect heartbeats under trucks.

Stuparu is on the front line of this effort near the town of Beba Veche as he scans for migrants from Syria, Afghanistan and elsewhere.

“This is the point where all migrants want to cross … but the Romanian border police is here and has succeeded to stop all their attempts until now,” he told the AP.

Romania, which has a 547-kilometer (340-mile) land and a river frontier with Serbia, has invested heavily in border control over the past year to prevent migrants illegally passing through the country on their way to Western Europe. Romania also has a long border with Hungary, but the only area of concern to border officers is the southern part of it.

Migrants have proved ingenious in their sometimes life-threatening attempts to illegally enter Romania. They hide under trucks, take the short but perilous journey across the Danube or simply walk under cover of darkness from Serbia into Romania.

But compared to neighbors Hungary and Serbia, Romania has largely been bypassed by the huge influx of migrants.

It’s a member of the European Union, but not the passport-free Schengen zone. The journey through Romania means a long detour for migrants, most of whom are trying to reach Western Europe. Still, authorities believe that Romania may become a new route for some migrants because of border closures elsewhere and has beefed up border control.

Police say 725 migrants tried to illegally cross into Romania in the first nine months of the year, 39 percent less compared to the same period in 2015.

Still, many migrants are desperate enough to try routes fraught with danger. Even though the weather has grown colder, migrants continue to come.

Border police said Monday they detained three Pakistani men aged 17-27 who are suspected of illegally entering Romania from Serbia. They told police they wanted to reach relatives in Italy.

Last week, Romanian border police caught 34 people allegedly trying to illegally cross into and then leave Romania, including nine men from Syria and Turkey who hid in a truck transporting cleaning materials, a heavily pregnant woman with her husband, and a group of 17 from Vietnam, Syria and Afghanistan, including four children aged between 4 and 6, who also walked into Romania from Serbia.

Romania’s border police force has 13,000 officers and has deployed reinforcements to southwest Romania this year to curb illegal border crossings, although the exact number of extra officers dispatched to the area hasn’t been disclosed.

In the past, guides were fined, but recently four Serbs suspected of acting as guides for migrants, have been detained in a bid to serve as a deterrent.

In the port of Calafat, across the Danube from the Bulgarian port of Vidin, border guards use sniffer dogs and equipment which can detect heartbeats to search for stowaways.

Police officer Cristian Anghel Stere monitored his computer screen as a colleague checked under a truck.

“In this case we have a green light, which means everything is ok and the truck is ready go,” Stere said.

Not all migrants want to reach Western Europe.

Mohammad Razib is a 30-year-old Bangladeshi IT engineer, who went first to Slovenia and Hungary, before heading east to Romania where he is seeking refugee status.

Like many refugees, he has been offered shelter in the UNHCR Emergency Transit Center in the southwestern city of Timisoara.

“I came to Europe for a better life,” he said, describing his journey. “I want to start my life in Romania and I’m also looking for a good job.”

Alison Mutler contributed to this report from Bucharest.