A 67-year-old gunman killed a lawyer in a Copenhagen courthouse and seriously wounded the father of his three-year-old grandchild in a reported family dispute.

The dead man is a 57-year-old lawyer and his client, a 31-year-old man who was in a custody battle over a dispute over visitation rights with the gunman's daughter, said police and court officials. According to witnesses, five or six shots were fired.

"This is about the love of a child, which makes it extra terrible," Søren Axelsen, a court representative told TV2.

According to police, the mother in the visitation proceedings did not appear in court, instead sending her father to represent her. Her father concealed a rifle in a bag, pulled it out and shot both his daughter's ex-partner and the lawyer.

One witness told reporters that the gunman fled the court and was later arrested in a street beside the city hall.

Police took possession of a rifle used in the shooting, according to an AP report.

"It is a family tragedy, not an attack on the court or the legal system," said Soeren Axelsen, head of the Copenhagen City Court.

The names of the dead lawyer and the wounded man have not yet been released.

The shooting is said to have happened in the Bailiff's court, which is part of the city court.

First reports suggested that one of the victims was shot inside the building and another outside. But Axelsen denied this and said both were shot inside the Bailiff's court. The child's father then staggered outside where he collapsed.

He was taken to hospital with serious wounds, but his condition is not life-threatening, police said.

The lawyer was pronounced dead at the scene.

Police cordoned off several streets around the building, which is next to City Hall.

Ritzau news agency reported that there was a "massive" police presence at the scene after the shooting and that several streets were closed off.

The Danish judges' association is demanding action to improve security. They are alarmed that the man managed to smuggle the weapon into the building without being challenged, and were concerned over this type of security breach.