The pair, who police said were seized in the southern port city a few moments apart from each other, were radicalised French nationals aged 24 and 30, the minister, Ms Matthias Fekl, said.
"These two radicalised men ... intended to commit in the very short-term - by that I mean in the coming days - an attack on French soil," Mr Fekl told a news conference.
A definite attack had been headed off, he said.
France goes to the polls to choose a new president on April 23 and on May 7 in a two-stage election.
National security figures high on the agenda in the ballot after attacks by terrorists across France which have killed more than 230 people in the past two years.
With the country still under a state of emergency, Mr Fekl said more than 50,000 police, gendarmes and soldiers would be deployed for each leg of the election.
Neither Mr Fekl nor police gave any precise details of what attacks the pair had been planning and whether they were intending to target one or more of the election candidates.
Far-right leader Marine Le Pen, one of the foremost candidates, is scheduled to hold the last big rally of her campaign in Marseille this week, according to her programme.
Separately, sources in the camp of conservative Francois Fillon said they had been warned there was a security risk for the right-wing candidate.
(Reporting by Emmanuel Jarry, Simon Carraud, Sarah White, Writing by John Irish and Richard Balmforth)
Get the latest election news, live updates and election schedule for Lok Sabha Elections 2019 on ndtv.com/elections. Like us on Facebook or follow us on Twitter and Instagram for updates from each of the 543 parliamentary seats for the 2019 Indian general elections.