An Italian teenager accused of raping a 17-year-old British girl on a European cruise has walked free on a legal technicality because the alleged attack occurred in international waters.

The victim, who was travelling with her parents, reportedly told Spanish police that her attacker forced her into his cabin before raping her on Thursday as the MSC Divina cruise ship made its way to Valencia in Spain from the Mallorcan capital of Palma.

The suspect, an 18-year-old who is understood to live in Italy, was arrested by police the following day on the vessel, which is registered in Panama.

However, he was later freed by a duty court in the city after the judge concluded he did not have jurisdiction to probe the alleged crime because it was committed by a foreigner on another foreigner in international waters and on Panamanian territory.

The release has been linked to Spain’s legal reforms of the doctrine of universal jurisdiction.