TOKYO — A court in Japan on Monday sentenced to death a man who fatally stabbed 19 people in 2016 at a center for the disabled, one of the worst mass murders in the country’s history.

The killer, Satoshi Uematsu, 30, had told the court in Yokohama that he had carried out the assault in an effort to rid Japan of people with mental and physical handicaps, telling officials he had been inspired by Hitler, according to news reports.

The rampage profoundly shocked Japan, where violent crime is relatively unknown, and it offered a searing reminder of the deep stigma attached to disabilities in Japanese society.

Mr. Uematsu had spent years working at the suburban Tokyo center where he carried out the attack, but had left several months beforehand. He had been briefly committed to a hospital by the local authorities after trying to give a politician a letter threatening to kill hundreds of disabled people “for the sake of Japan.”