Paris (CNN) -- This week's shooting of three soldiers in the southwestern French city of Montauban has been linked to Sunday's similar attack in Toulouse, 31 miles away, a prosecutor said Friday.
Two French soldiers died and a third was critically injured after being shot by a black-clothed man wearing a motorcycle helmet in Montauban, the French Defense Ministry said Thursday.
The Toulouse shooting also killed a French soldier, authorities said.
"The link was made in a very certain manner between the shootings in Toulouse and Montauban," Toulouse prosecutor Michel Valet said.
Valet declined to elaborate.
But Toulouse police Capt. David Delattre said the same kind of ammunition was used in both shootings, describing the caliber as 1143.
On Sunday, a soldier from the Francazal Regiment in Toulouse who was attached to the 1st RTP (Regiment Transission Parachutiste) was on his motorbike when a man wearing a helmet on another motorcycle pulled up and shot him, Delattre said.
The soldier, 39, died at the scene, Delattre said.
The soldier was not in uniform, and his motorbike did not have any military identification, Delattre said.
Col. Thierry Burkhard, a Defense Ministry spokesman, said security measures have been taken in the wake of the shootings in Montauban, and soldiers have been asked not to be unnecessarily exposed in uniform and to avoid wearing their uniforms if they're not on duty.
The ministry has also warned soldiers guarding military bases to be vigilant.
In Montauban, three soldiers were at a commercial center when a man approached them, pulled a gun and started firing, city police Cmdr. Charles Cauquil said. Two of the soldiers, ages 24 and 26, died at the scene.
The police and army were searching for the shooter, who fled the scene after the attack. The judiciary police in Toulouse were investigating the shooting, Cauquil said.
The three soldiers belonged to the 17th parachute regiment stationed in Montauban, a Defense Ministry spokesman said.
Montauban, capital of the Tarn-et-Garonne area, is about 50 kilometers (31 miles) from Toulouse.
CNN's Per Nyberg, Stephanie Halasz, Pierre Meilhan, Dheepthi Namasivayam and Michael Martinez contributed to this report.