The men discussed the would-be plot, which included possibly taking hostages or machine-gunning victims, while they were serving time in Fresnes prison south of Paris.
“These two radical Islamists wanted to set up a group of fighters with the aim of… various actions outside prison,” said one of the probe sources.
One of the suspects is a 28-year-old Cameroonian described by authorities as an Islamic State group sympathiser, while the other is a 22-year-old Frenchman.
Both were behind bars for non-terror offences and were suspected of being radicalised while serving their sentences. They were charged Friday with being part of a terrorist conspiracy.
The Cameroonian man was also believed to have been in contact with a person in Iraq or Syria, where Islamic State is under pressure from a US-led coalition.
France has been under a state of emergency since the IS gun and bomb attacks in Paris in November 2015 — part of a string of jihadist assaults that have left more than 240 people dead over the past two years.