In the surprise decision, the Oslo district court said the isolation that Breivik faces in prison for killing 77 people in a bomb-and-gun massacre in 2011 is in breach of the European Convention on Human Rights.
"The prohibition of inhuman and degrading treatment represents a fundamental value in a democratic society," the court said. "This applies no matter what — also in the treatment of terrorists and killers."
The court ordered the government to pay Breivik's legal costs of 331,000 kroner, about $41,000. However, it dismissed Breivik's claim that his right to respect for private and family life was violated by restrictions on contacts with other right-wing extremists.
Breivik, 37, had sued the government, saying his isolation from other prisoners, frequent strip searches and the fact that he was often handcuffed during the early part of his incarceration violated his human rights. During a four-day hearing last month at Skien prison in southern Norway, where he is serving his sentence, he also complained about the quality of the prison food, having to eat with plastic utensils and not being able to communicate with sympathizers.
The government rejected his complaints, saying he was treated humanely despite the severity of his crimes and that he must be separated from other inmates for safety reasons.
"We are surprised," government attorney Marius Emberland told The Associated Press after the verdict. "We are not in agreement with the court."
He said his team would study the verdict carefully before deciding whether to appeal.
Breivik has been held in isolation since the July 22, 2011, attacks. The court said it couldn't see why he can't be allowed to meet other inmates in the high-security section under the supervision of prison guards and why he cannot see his lawyer without a glass wall separating them. The court noted that Breivik has behaved in a "peaceful, courteous and accommodating" manner, despite a 2013 letter in which he wrote he knew how to "neutralize" prison guards and how to make 10-15 deadly weapons from materials in his cells.
It also said authorities hadn't given enough attention to his mental health when determining his conditions in prison.
"After an overall assessment of the facts of the case, the court has reached the conclusion that the imprisonment regime represents an inhuman treatment of Breivik," the court said.
Breivik's lawyer, Oystein Storrvik, told the AP his client was satisfied with the ruling and that prison authorities must now lift some of his restrictions.
"I expect them to do something about isolation and allow him to meet other people," Storrvik said. "I am confident that he will not do any violence in the prison."
Bjoern Ihler, who survived Breivik's shooting massacre on Utoya island, said he respects the court's decision, though he thought other survivors might be angry and upset.
"It is important that we stick to the principles of the Norwegian system," Ihler told the AP.
After months of meticulous preparations, he set off a car bomb in 2011 outside the government headquarters in Oslo, killing eight people and wounding dozens. He then drove to Utoya, where he opened fire on the annual summer camp of the left-wing Labor Party's youth wing. Sixty-nine people there were killed, most of them teenagers, before Breivik surrendered to police.
International observers were stunned by how far Norwegian authorities went in accommodating him during his 2012 trial. He was even allowed to use the stand as a pulpit to profess his extremist views.
He was convicted of terrorism and mass murder and sentenced to 21 years in prison, Norway's maximum sentence. However, the sentence can be extended for as long as he's considered a menace to society.
At the time of the attacks, Breivik claimed to be the commander of a secret Christian military order plotting an anti-Muslim revolution in Europe. Investigators found no trace of the group. He now describes himself as a traditional neo-Nazi who prays to the Viking god Odin, saying his earlier crusader image was just for show. He made a Nazi salute to journalists at the start of his human rights case in March.
Professor Kjetil Larsen of the Norwegian Institute of Human Rights said he expected the verdict to be met with "considerable surprise" both internationally and in Norway. Larsen said he thought it was clear from the start that Breivik's treatment doesn't violate his human rights.
"I thought that what came out during the trial made that even clearer," he said.
Larsen said the government will probably appeal the ruling and that prison authorities won't be obliged to change Breivik's imprisonment conditions until there's a final judgment.
Only a handful of survivors and victims' family members followed the proceedings. Others ignored the case, saying they didn't want to give Breivik any attention.
Breivik has three cells to himself in the high-security wing of Skien prison. The cells are equipped with video game consoles, a television, a DVD player, electronic typewriter, newspapers and exercise machines. He also has daily access to a larger exercise yard. He is allowed visits from family and friends, but hasn't received any except for his mother before she died.
The court that convicted him in 2012 found him criminally sane, rejecting the prosecution's view that he was psychotic. Breivik didn't appeal his sentence. He has been trying to start a fascist party in prison and reached out by mail to right-wing extremists in Europe and the United States. Prison officials seized many of those letters, fearing Breivik would inspire others to commit violent attacks.