The gunman who killed nine people in a shooting spree in Munich on Friday was a school student born and raised in the city who was believed to have been in psychiatric care and had taken an intense interest in mass shootings, officials said Saturday.