The man, named as Claudio Giardiello, escaped on a scooter but was captured by police in Vimercate, a town some 25 kilometres (15 miles) outside Milan, the interior ministry said.
The dead were named by the Italian media as judge Fernando Ciampi and lawyer Lorenzo Alberto Claris Appiani, both shot on the third floor of the building after Giardiello managed to get a gun past security.
A third person was found dead inside the building after apparently suffering a heart attack, possibly brought on by the shooting, emergency services said.
Valerio Maraniello, who once acted as a lawyer for the shooter, told AFP his ex-client was "an aggressive person, a little paranoid."
"He was always convinced people were trying to cheat him. He never listened to advice," he said, adding that he was "not completely surprised" by the deadly attack.
Regional authorities were shocked that anyone had managed to get into the court building with a gun.
"It's disturbing that just anyone can get into the Palace of Justice armed," said the head of the Lombardy region, Roberto Maroni.
Interior Minister Angelino Alfano, who was in Milan for a national committee meeting on public order and safety ahead of the 2015 Milan expo which opens in May, was called on to investigate security at the court.
The sound of shots sparked panic, with lawyers bolting for the exit while police officers went floor to floor searching for the gunman, who was initially thought to be still inside the building.
"All of a sudden we heard at least three or four shots," lawyer Marcello Ilia told AFP outside the court.
You’ve reached your limit of {{free_limit}} free articles this month.
Subscribe now for unlimited access.
Already subscribed? Log in
Subscribe to read the full story →
Smart Quarterly
₹900
3 Months
₹300/Month
Smart Essential
₹2,700
1 Year
₹225/Month
Super Saver
₹3,900
2 Years
₹162/Month
Renews automatically, cancel anytime
Here’s what’s included in our digital subscription plans
Exclusive premium stories online
Over 30 premium stories daily, handpicked by our editors


Complimentary Access to The New York Times
News, Games, Cooking, Audio, Wirecutter & The Athletic
Business Standard Epaper
Digital replica of our daily newspaper — with options to read, save, and share


Curated Newsletters
Insights on markets, finance, politics, tech, and more delivered to your inbox
Market Analysis & Investment Insights
In-depth market analysis & insights with access to The Smart Investor


Archives
Repository of articles and publications dating back to 1997
Ad-free Reading
Uninterrupted reading experience with no advertisements


Seamless Access Across All Devices
Access Business Standard across devices — mobile, tablet, or PC, via web or app
