Activists and others providing humanitarian aid including food and shelter have faced up to five years in prison and fines of 30,000 euros ($35,000), though most people convicted have been given much lighter sentences.
But the court said such measures went against the basic French “principle of fraternity”.
“As with liberty and equality, which are the two other terms of our country's motto, fraternity must be respected as a constitutional principle by lawmakers,” Laurent Fabius, a former prime minister who heads the court, told AFP.
The case was brought by Cedric Herrou (see below), an olive farmer in southern France who has made a point of helping migrants crossing the border from Italy, the main point of entry for thousands of people setting sail across the Mediterranean from Africa in recent years.
Cedric Herrou. Photo: AFP
Herrou was given a four-month suspended sentence last August for helping about 150 migrants trying to enter France, and he was also convicted for sheltering some 50 Eritreans in a disused railway building.
His lawyer called the court's decision an “immense victory” that could eventually allow Herrou's sentencing to be overturned.
“Lending a hand to a foreigner, as long as it's not done for gain, should not be punishable,” Patrice Spinosi told AFP.
President Emmanuel Macron's government is pursuing a tough new immigration law that speeds up the asylum process and accelerates deportations.
But it eventually agreed to drop planned penalties for anyone providing struggling newcomers with food and accommodation as well as medical, linguistic, legal or social assistance.
Interior Minister Gerard Collomb welcomed the court ruling, saying it did not allow people to directly facilitate illegal border crossings, which would still enable the government to prosecute criminal people-trafficking networks.
The ruling comes as tensions are running high among European countries over how to handle the influx of migrants fleeing war and misery in Africa, the Middle East and South Asia.
France received a record 100,000 asylum applications last year, though the overall numbers entering Europe have fallen sharply from their peak in 2015.
According to the International Organisation for Migrants (IOM), 57,160 migrants have arrived in the European Union since the beginning of the year, with 80 percent landing on the Italian, Spanish or Greek coasts.
An activist plays an harmonium during a “Briser les frontieres” (break the borders) activist group march in support of migrants. Photo: AFP
Italy's new populist government has pushed the issue to the forefront of the EU agenda by refusing to open the country's ports to migrant rescue ships operating in the Mediterranean.
The country's far-right Interior Minister Matteo Salvini has called for a Europe-wide alliance against “mass immigration” and has warned that Italian ports will be closed to NGO ships “all summer”.
France itself came under fire last month for not offering to take in the Aquarius charity ship carrying 630 people after Italy and Malta refused to let it dock, forcing it to travel on to Spain.
European leaders managed to reach a deal last week to consider setting up asylum processing centres outside the bloc, most likely in North Africa, in a bid to discourage migrants boarding EU-bound smuggler boats.