A gunman has killed three people in a shooting spree at the Palace of Justice in Milan in northern Italy.
The suspect, Claudio Giardiello, was arrested in a suburb after fleeing the scene on a motorbike. He was reportedly a defendant in a bankruptcy case.
He is believed to have shot dead a co-defendant, his former lawyer and a bankruptcy court judge.
Earlier reports of a fourth death were proven wrong. The shooting has prompted scrutiny of security measures.
Questions are being asked about how Mr Giardiello managed to smuggle a weapon into a well-guarded building, use it several times and escape.
The suspect was arrested by carabinieri officers in Vimercate, about 25km (15 miles) north-east of central Milan, near the town of Monza.
Interior Minister Angelino Alfano said the "presumed assassin" had been taken to a military police barracks in the Milan area.
The sound of gunfire had sparked panic inside the Palace of Justice on Wednesday morning.
Hundreds of people poured down stairways towards the exits while police and military police officers searched for the gunman.
"All of a sudden we heard at least three or four shots," lawyer Marcello Ilia told the AFP news agency outside the building.
"We tried to find out what was going on. There were suddenly lots of police officers who told us not to leave the room, they shut us in," he said.
"After a few minutes we came out. They told us someone in a suit and tie was armed and at large in the court."
The newspaper La Repubblica, quoting officials and witnesses, said that the gunman had been attending a bankruptcy hearing when a fight broke out inside the third floor courtroom.
He pulled out a weapon and shot the lawyer, named as Lorenzo Alberto Claris Appiani, as well as one of his co-defendants, named as Giorgio Erba.
According to La Repubblica, Mr Appiani was a former lawyer for Mr Giardiello who was acting as a witness in the case.
The gunman then left the courtroom and headed to the office of appeals court judge, Fernando Ciampi, shooting him dead. It is not known if the gunman had any links to the judge.
Several media outlets had earlier said that a fourth person had died in the incident of a possible heart attack, after reports of a body found at the building with no obvious injuries.
But the reports - based on a statement from the emergency services, according to AFP news agency - have been proven incorrect, with the body in question now believed to have been that of Mr Erba.
Another two people were wounded in the shooting and are being treated at a hospital.
After hiding inside the Palace of Justice for more than an hour, the gunman fled on a motorbike, according to La Repubblica.
Mr Giardiello was described as "aggressive" and "a little paranoid" by his former lawyer, Valerio Maraniello, in comments quoted by AFP news agency.
Visitors to the Palace of Justice have to pass through metal detectors.
Lawyers and courthouse employees with official identification are, however, regularly waved through, according to the Associated Press.
Ansa reported that one of the metal detectors was broken on Wednesday morning.
Italian Prime Minister Matteo Renzi described the attack as "a moment of great pain, of sadness".
He praised the police who arrested the man but said it was "unthinkable" that someone could enter a court with a weapon, and promised an inquiry into the incident.
The Palace of Justice is in the centre of Milan, only a few streets away from the city's cathedral and main shopping district.