The Garda Síochána Ombudsman Commission has begun an investigation into the temporary loss of an official garda firearm.
An internal garda investigation is also under way after the gun went missing for a time in Dublin yesterday evening and was handed into a garda station a short time later.
The incident happened at around 5.30pm at Harcourt Square in the city centre.
A sub-machine gun with ammunition fell out of an emergency response unit vehicle after it went over a ramp and the boot opened.
It is understood the weapon and ammunition were in an official carrier bag. The garda patrol vehicle, an Audi Q7, was in traffic at the time.
Garda sources say the officers saw the incident happen and witnessed a member of the public pick up the gun.
However, by the time they had pulled over and got to the scene, that person and the bag with the gun in it were gone.
The weapon, a Heckler & Koch MP7, was handed into Store Street Garda Station 25 minutes later.
Gardaí do not believe the weapon had been fired and all the ammunition has been accounted for.
The person told gardaí they knew it was garda property, but had not looked in the bag.
They said they did not know they had been carrying a gun and ammunition.
Garda Headquarters has confirmed the incident is being investigated. GSOC said this afternoon it was opening a public interest inquiry into the incident.
A spokesman said a senior garda officer has been appointed to examine the circumstances surrounding the incident and that inquiries are ongoing.
This will include an examination of the mechanics and road worthiness of the garda vehicle and a review of security procedures.
Gardaí also say the unit concerned is involved in ongoing operations in the Dublin region targeting organised criminal activity and was not part of the security detail attached to the royal visit.
Minister for Justice Charlie Flanagan described the incident as a matter of grave concern.
He said: "I was informed yesterday evening of an incident in Dublin, where it appears a machine gun fell out of the back of a car and was handed in by a very civic-minded citizen into the gardaí. So luckily any danger was averted.
"The issue is currently the subject matter of an investigation by a chief superintendent. It is a matter of grave concern. I'm very concerned about the issue. How it might have happened. How it did happen. I'm looking forward to an early report.
"But clearly something went wrong. Something happened here that shouldn't have happened."