The legislation is also set to allow secondary schools to decide whether to impose a total or partial ban on the devices.
Critics have called the law a "publicity stunt" that would change nothing, according to Agence France-Presse.
While the lawmakers from President Macron's centrist LREM party finally approved the ban that was put forward in December previous year, the lawmakers from the left and right abstained from voting touting the ban as a "publicity stunt".
"General ban on mobile phones in schools and colleges", Blanquer tweeted on Monday (complete with the two camera emoji ). "It is a fundamental role of education, and this law allows it", Education Minister Jean-Michel Blanquer said of the ban on French news channel BFMTV. Students with disabilities are not included in the ban.
The law is France's bid in the fight against children's smartphone addiction.
One recent study from Korea showed teenagers who were being treated for smartphone or device addiction had higher levels of a neurotransmitter that slows down neurons than their non-addicted peers. They could easily hide their phones under their desks and use them during lectures.
Today, approximately 90 percent of children in France aged between 12 and 17 own their own smartphone.
The French education code already bans the use of phones during teaching hours, a rule which has been in place since 2010.