Swedish authorities and vehicle makers have expressed hope that digital technology can prevent trucks from being used in terrorist attacks in cities, though legal hurdles remain.

A seminar on Tuesday at the Royal Institute of Technology in Stockholm, hosted by the Swedish Transport Administration, focused on geo-fencing technology, which can trigger certain pre-programmed actions in vehicles.

Interest in the technology was raised in Sweden after a hijacked truck was used to kill five people in Stockholm in April 2017.

"The technology is there, the actors - cities and vehicle makers - are interested, but we have to have a legal framework on a European level," Tomas Eneroth, Sweden's infrastructure minister, told dpa.

Eneroth was one of the speakers at the seminar, during which he and other attendees were given the chance to ride in a bus, a truck and a car equipped with the technology along the main street of the institute's campus.

After the test drives, Eneroth said he "realised that this technology could have prevented or reduced the effects of the [Stockholm truck] attack, so this is very close to my heart."

The car, a Lincoln, had been fitted with safety technology by Vioneer, a maker of automotive safety systems. The car came to a complete halt when the driver tried to enter a one-way street from the wrong direction on the test route.

It also braked automatically at a virtual stop light that was programmed into its navigation system.

On the bus, passengers were able to experience how speed was adjusted according to the vehicle's location in different zones. In a pedestrian zone, the driver was unable to accelerate, despite pressing down hard on the accelerator pedal.

"The main challenge in the short term is to get a functioning legal framework, both in Sweden and on a general European level," Eneroth said, adding the topic would probably be raised in June when he hosted a meeting of European Union transport ministers.

Using the global positioning system (GPS), geo-fencing technology could be used to automatically reduce the speed of a vehicle if it was driven into a pedestrian area.

Several cities in Europe - including Barcelona, London, Berlin and Nice - have seen vehicles used to target crowds of civilians in the past two years.

Maria Krafft of the Swedish Traffic Administration said it was not possible under current legislation to use the technology to block vehicles.

Krafft added that the technology could be used to allow police to set up temporary zones, for instance during big public events.