A masked bandit who robbed a McDonald's restaurant at gunpoint was overpowered by staff and customers during the heist.

A Melbourne court heard on Monday that Tyler Forsyth, 20, threatened his three victims with a sawn-off bolt-action rifle at the family restaurant in Mulgrave last November at 12.20am.

Prosecutor Jelena Malobabic said Forsyth pointed to firearm, which was not loaded but in working order, at the manager and two customers who all feared for their lives.

Ms Malobabic told the County Court that Forsyth stole $700 from the till and demanded the wallets of the customers he had ordered onto their knees at gunpoint.

She told Irene Lawson that the two customers then approached Forsyth from behind, tackled him to the ground and subdued him.