The armed men burst into the fast food outlet in the commune of Ecole-Valentin late Sunday, with one firing a warning shot while the other raided the till for cash.
But amongst the around 40 diners in the burger joint were 11 members of an elite branch of the French Armed Forces — particularly hardened soldiers who specialise in hostage situations.
The off-duty soldiers waited for the end of the heist to intervene so as not to put other patrons in danger, Besancon public prosecutor Edwige Roux-Morizot said on Monday.
The first man, who was carrying around 2,000 euros ($2,270) cash, stumbled as he attempted to flee and was captured, while the other was shot in the abdomen by one of the elite forces and arrested.
The two men are currently in hospital and will appear before a judge on charges of armed robbery and violence, Roux-Morizot said.