The European Court of Justice, in a ruling released Tuesday, said European Union countries cannot jail illegal immigrants simply for crossing borders inside the continent's 26-nation passport-free area known as the Schengen zone.

The court in Luxembourg said EU rules prevent such arrests, unless non-EU migrants are suspected of having committed a crime or already have been subject to deportation procedures. It also ruled against arrests made at Schengen borders as migrants head elsewhere on the continent.

The impact of the court decision was not immediately clear.

The ruling — issued as Europe grapples with a massive influx of migrants from the Middle East and Africa — came in the case of Ghanaian national Selina Affum, who was detained in 2013 by French police at the Channel Tunnel. The detainee was traveling by bus from Belgium to Britain, using someone else's passport.

French police charged her with illegal entry into France and then asked Belgium to take her back. Her lawyers challenged the arrest, saying it violated standard EU rules and procedures for member states when removing non-EU migrants who were in their territory illegally.

With the influx of more than 1 million non-European migrants in the past 18 months, laws governing the Schengen zone have come under intense scrutiny from governments seeking to curb the migration.

Some Schengen countries, including Balkan nations, have addressed the crisis by reinstituting border controls that were scrapped more than a decade ago.