Cedric Herrou, an olive and poultry farmer from a village on the border with Italy, risks a maximum five-year prison sentence and a 30,000-euro ($31,500) fine if convicted.
But Herrou was unrepentant as his case was heard Wednesday at a court in Nice, CNN affiliate BFMTV reported.
A crowd of more than 300 people gathered to cheer him on as the farmer and activist left the courthouse, BFMTV said. Some held a banner reading: "Yes to solidarity and welcome migrants and refugees."
Speaking to reporters, Herrou said: "It's not up to me to make a distinction between black and white, people with or without papers. It's not my job. Farming is what I do, my job is feeding people and that's what I do."
Herrou has sheltered several hundred migrants over recent months in the grounds of his home in Breil-sur-Roya, in the hills above the French Riviera town of Menton and the Italian town of Ventimiglia, according to BFMTV.
A verdict in the case is expected on February 10, Herrou's lawyer Zia Oloumi told CNN.
Europe has been struggling to cope with a mass movement of migrants fleeing war, persecution and poverty, particularly in the Middle East and Africa. Hundreds of thousands have crossed the Mediterranean
, many reaching Italy and seeking to travel on from there.
Defense lawyer: 'There is no offense'
According to Oloumi, Herrou was arrested on October 20 with three other people at a property belonging to the French national railway company, SNCF. With them were 57 migrants, of whom 29 were children, according to Oloumi, as well as about 30 members of an NGO run by Herrou, including doctors and nurses.
Of the three arrested, only Herrou is being prosecuted, Oloumi said, on charges of "aiding the entry, stay and circulation of foreigners in an illegal situation" and the "illegal occupation of a private domain." He denies the charges.
Herrou was previously caught in August with eight Eritreans in his truck while crossing the border, Oloumi said, but was not charged in relation to that.
At Wednesday's hearing, the prosecution asked for an eight-month suspended prison sentence, Oloumi said.
But the defense asked for an acquittal, on the grounds that the prosecution provided no proof that the people Herrou was helping were there illegally.
"This is a political trial, what Cedric Herrou did is not illegal," Oloumi told CNN. "There is no offense, the fact that there were foreigners in an illegal situation was not sufficiently proven."
He added, "What worries me is that a value of the republic, solidarity, may disappear because of a wrongful interpretation of the law."
Herrou: 'Not my job to ask for people's papers'
CNN spoke to Herrou in October while reporting on the situation for migrants in Ventimiglia, a town less than 10 kilometers (6 miles) from the French border which had become known as "Little Calais" -- a reference to the French town that became famous for its "Jungle" migrant camp
In Ventimiglia's Red Cross camp, hundreds awaited relocation. But others were determined to avoid the limbo of life inside the fence, instead sleeping rough in and around the town -- or looking for a chance to leave.
Herrou described how he had helped many who wanted to move on.
"Sometimes at 2am, 3am, we go and pick up minors in Italy, minors who have called me, who are in Ventimiglia sleeping rough," he said. "I help the minors who don't have papers cross the border. It's not my job to ask people for their papers."
Herrou said he offered the young refugees a place to stay and rest before continuing their journey.
"In the Roya valley, it's a tradition," he said. "If you look at the Second World War, we have a history of helping people, of welcoming them. We have a rebellious spirit."
Among the migrants who spoke to CNN was Zahra, 14, who had been traveling with her baby niece for six months.
She said Herrou also offered them something even more important: hope.
"He's like our father, our mother," she told CNN. "In all my life I never met anyone like Cedric. He's very kind and he helps us, everyone here."