GARISSA, Kenya—One of the four gunmen who killed 148 people at a Kenyan college last week was the son of a government official, the country’s Interior Ministry said, underscoring the country’s challenges in tackling homegrown extremism.

Ministry officials on Sunday identified the gunman, who was killed by Kenyan security forces during the attack at the university campus, as Abdirahim Abdullahi. The man’s father, an official in Kenya’s Mandera district, had reported his son missing last year and was cooperating with the authorities, a ministry spokesman said.

The 20-year-old had been studying law at Nairobi University and was a top student, according to the Interior Ministry spokesman, Mwenda Njoka. But last year, the young man withdrew from family and friends and eventually went missing.

“The family told us that he became withdrawn and very critical of everything and everyone,” Mr. Njoka said. “The family is Muslim, but Abdirahim criticized them about how they behaved and worshipped. At first, the parents thought he was just being a typical teenager, until he disappeared.”

Kenyan authorities say Mr. Abdullahi is one of a number of young Muslim Kenyan men and women who have become radicalized at home and have eventually been drawn into training camps in Somalia by false promises of a meaningful life as members of al-Shabaab. The Somalia-based militant group, which has pledged allegiance to al-Qaeda and controls swaths of territory in Somalia, claimed responsibility for last week’s attack. It has carried out other shooting massacres in Kenya and bombings in Uganda.