French soldiers, policemen and firefighter vehicles are seen at the site of a police search
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 Interior minister, Matthias Fekl, said.
Mr Fekl told a news conference: "These two radicalised men, born in 1987 and 1993, of French nationality, intended to commit in the very short-term – by that I mean in the coming days – an attack on French soil."
He aded that "a definite attack had been headed off."
It's thought that their target was scandal-hit presidential hopeful Francois Fillon, according to reports by AFP and Liberation newspaper.
His security officers were warned on Friday of "proven risks" on the right-wing candidate.
The Ministry of Interior "strengthened security in Montpellier", where the candidate held a meeting on Friday, the source told AFP, referring to the presence of "snipers" at its public meetings.
There were also fears over Mr. Fillon's meeting in Nice on Monday.
Emergency vehicles are seen at the site of a police search in France
Matthias Fekl said: "A definite attack has been headed off"
Live images: Terror at French election
Tue, April 18, 2017
Get Quotes on Home Insurance
1 of 8
Members of the French RAID police unit leave after searching the home of one of two men arrested in Marseille on April 18, 2017 after they were suspected of plotting an
According to police, the two terror suspects were preparing an "imminent" attack.
They were arrested by the DGSI in the course of a flagrant investigation opened in Paris on 12 April for criminal criminal terrorist association and breach of arms legislation in connection with a terrorist enterprise.
A search of a rented apartment was also underway.
French policemen are seen at an address in the third district of Marseille
Guns and bomb materials were found in a raid, a source close to the inquiry told AFP.
The two suspects appeared to have turned to radical Islam during a term in prison.
Mr Fekl said security surrounding the elections and the candidates had been strengthened.
It's thought that Francois Fillon was the target in the planned terror attack
National security figures high on the agenda in the ballot after attacks by militant Islamists 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.
"Everything has been put in place to ensure the security of this big event for our democracy and our republic.
Police had been hunting the pair since the end of last week
"The security forces are mobilised everywhere across France to ensure the security of French people and to ensure the presidential campaign goes smoothly," he said.
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.
Putin: We reserve right to talk to all candidates in French election
Le Pen voters hail "great Brexit" ahead of French election
UK firms can sell bacon sandwiches in France due to weak pound