French soldiers, policemen and firefighter vehicles are seen at the site of a police search
France's interior minister Matthias Fekl, told a news conference that the two men had been arrested for plotting to carry out a terror attack.
He said: "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."
Mr Fekl said police were carrying out searches and that security surrounding the elections and the candidates had been strengthened.
Police, who had been hunting the pair since the end of last week, seized them a few minutes apart in the southeastern port city, the police source said.
The police source said the two men appeared to have turned to radical Islam during a term in prison. A search of a rented apartment was underway.
France goes to the polls to choose a new president on April 23, with a second round of voting due on May 7.
Live images: Terror at French election
Tue, April 18, 2017
1 of 5
French soldiers, policemen and firefighter vehicles are seen at the site of a police search are seen at the site of a police search on April 18, 2017 in the third district of Marseille, following the arrest of two men suspected of preparing an attack
France has been under a state of emergency, which has been extended several times, in the face of Islamist militant attacks in Paris and other parts of the country in which more than 230 people have been killed.
Get Quotes on Home Insurance
Earlier today, the Interior Minister said that security was tightened across France ahead of the election.
It comes after more than 230 people have died in Islamist militant attacks in the country over the past two years.
This is a breaking news story. Please refresh your browser for updates.
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