A gunman opened fire in a Milan courtroom, killing a judge and as many as two other people before being captured as he tried to flee on a motorbike, news reports and Italy's interior minister said.

Witnesses reported barricading themselves inside their offices and taking cover under their desks as police hunted for the gunman. The employees trickled out, women first, followed by the men who had their court ID cards checked.

ANSA quoted the president of the appeals court, Giovanni Canzio, as identifying the killed judge as Fernando Ciampi.

Quoting police sources, ANSA said two other people were killed, including a lawyer.

Interior minister Angelino Alfano said the suspect was caught by police as he tried to leave the scene on a motorcycle.

The shooting immediately raised questions about how the man gained entrance to the fortress-like courthouse, given visitors to the building must pass through metal detectors.

The courthouse has metal detectors at the four main entrances, but lawyers and courthouse employees with official IDs are regularly waved through without the additional security screen.

Employees who trickled out after the shooting suggested that the gunman could easily have gained entrance without passing through the metal detector by entering with his lawyer.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.