Lisbon, Sept 4: At least 15 people have been killed and 18 others injured after a carriage on Lisbon's famous Gloria funicular derailed and crashed, emergency services said.

Portugal's emergency medical service authority said that five of those injured were in a serious condition. The remaining 13, including a child, sustained minor injuries.

Several people were earlier said to have been trapped at the scene. They have all since been freed, authorities said.

Portuguese President Marcelo Rebelo de Sousa expressed his "sympathy and solidarity with the families affected by this tragedy". Lisbon's mayor, Carlos Moedas, said the capital was "in mourning", adding it was a "tragic moment for the city".

Emergency services said foreigners were among those killed were, although nationalities could not be confirmed.

It is unclear how many people were on board at the time of the cable railway crash, which occurred near the Avenida da Liberdade around 18:05 on Wednesday.

Footage shared widely on social media showed the bright yellow carriage overturned and almost entirely destroyed. People could be seen fleeing the area on foot as what appears to be smoke filled the air.

One witness told Portuguese newspaper Observador the vehicle was "out of control, without brakes".

"We all started running away because we thought [the carriage] was going to hit the one below," said Teresa d'Avó.

"But it fell around the bend and crashed into a building."

Another told Portuguese TV channel SIC that the funicular hit a building as it sped down the steep street "at full speed".

"It hit a building with brutal force and collapsed like a cardboard box; it had no brakes," the woman said.

The Lisbon authorities say it is too early to determine the cause of this incident.

However, Observador reported that a cable came loose along the railway's route, causing it to lose control and collide with a nearby building.

The transport company which runs the funicular, Carris, said it had opened an investigation, adding that "all maintenance protocols" had been respected.

European Commission President Ursula von der Leyen sent her condolences to the families of the victims.

Spain's Prime Minster Pedro Sánchez said he was "appalled by the terrible accident".