A machine gun, two hand guns and three kilos of TATP explosive were among the weapons found at a flat in Marseille raided by police after they foiled an imminent attack ahead of the French election, according to the Paris prosecutor.
The two Frenchmen had met while sharing a cell in prison and were known to police as having turned to radical Islam, prosecutor Francois Molins said at a news conference.
He added that an Islamic State flag and jihadist propaganda had previously been found at the home of one of the men, while the other was thought to have had links to a Belgian jihadist cell.
The two men allegedly "intended to commit an attack on French soil in the very short term, which is to say in coming days," Interior Minister Matthias Fekl said during a brief news conference earlier on Tuesday.
France votes on Sunday in the first round of its two-stage election. Extra safety measures are being put in place for the balloting after the extremist attacks in the country that have made security one of the major issues of the presidential campaign.
The men, both French, are "suspected of wanting to commit, in an imminent way, a violent action on the eve of the French presidential election", the minister said.
Mr Fekl gave no details about potential targets or motives.
The suspects, Mahiedine Merabet, 29 and Clement Baur, 23, were both detained under arrest warrants for terrorist criminal association, according to a police document obtained by The Associated Press.
President Francois Hollande hailed the "remarkable" arrests and the work of police.
Agents from the French domestic security agency, backed by elite police units, conducted the arrests. Searches are also underway, Mr Fekl said.
France's fight against homegrown and overseas Islamic extremism has been one of the main campaign topics for presidential candidates.
Candidates on the right have been especially vocal, seeking to appeal to voters traumatised by Islamic State group-inspired attacks that have killed at least 235 people in France since January 2015, by far the largest casualty rate of any Western country.