PARIS (Reuters) - A top French court on Friday ruled that the “principle of fraternity” should have shielded an olive farmer from prosecution over his role in helping hundreds of migrants to enter the country illegally.

Slideshow ( 3 images )

Cedric Herrou received a four-month suspended prison sentence last August for taking migrants from the Italian border to his farmhouse in the Roya Valley in southeastern France and housing them in a makeshift camp at a disused railway premises.

“The concept of fraternity confers the freedom to help others, for humanitarian purposes, without consideration for the legality of their stay on national territory,” the constitutional court ruled.

Fraternity is one of three values that make up France’s constitutionally enshrined national motto: Liberty, Equality and Fraternity.

The court said France’s parliament should adapt the law, and its ruling could reverberate across the European Union at a time of deep divisions within the bloc on how to deal with migrants.

Migrants who successfully cross the Mediterranean sea from Libya and elsewhere to Italy often go north and try and slip across the mountainous border into France. France tightened its border controls in 2015.

Herrou has said he believed he had a duty to provide food and shelter to desperate migrants fleeing war, poverty and oppression.

French law covering the entry of foreigners and right to asylum states that anyone aiding “the unlawful entry, movement, or stay of a foreigner in France” is liable to face up to five years in prison and a fine of up to 30,000 euros ($35,277.00).

However, it grants immunity to anyone who offers such help to a foreigner without receiving anything, such as money, in return. The court said the words “unlawful stay” should be removed to ensure that the principle of fraternity extends to those in France both legally and illegally.

In a statement, Interior Minister Gerard Collomb said the ruling was compatible with draft immigration and asylum legislation being debated in parliament.

The new law would double to 90 days the time in which illegal migrants can be detained, shortens deadlines to apply for asylum and makes the illegal crossing of borders an offense punishable by one year in jail and fines.

The center-right party, The Republicans, said it saw “major problems” with the ruling.

“This is an ideological victory for those who consider that illegal immigration is legitimate ...and an encouragement for those who think France doesn’t have the right to protect its borders,” Guillaume Larrive and Eric Ciotti, two of the party’s lawmakers, said.