A transit police officer was stabbed in the head Tuesday a day after a young girl was decapitated in apparently random knife attacks in Taiwan's capital.

The officer attacked at the Xinbeitou subway station in northern Taipei has serious injuries in the head, neck and back. He was taken to a hospital for injuries described as not life-threatening, according to the government's Central News Media and other reports.

A suspect apprehended at the scene was taken in for questioning but no immediate word was given on a possible motive.

Police are also seeking a motive in the attack on the 3-year-old girl who was grabbed from behind by an assailant as she waited with her mother outside another subway station in the capital. The 33-year-old suspect, identified as Wang Ching-yu, had past arrests for drug offenses and had sought treatment for mental illness, according to media reports.

Mourners who gathered Tuesday at the site of the girl's murder in the suburb of Neihu prayed and left flowers and stuffed toys.

Commentators debated possible reasons behind the attack and whether the normally placid island republic of 23 million people was becoming less safe.

The murder has also reignited a debate on whether to end capital punishment on Taiwan as some are campaigning for.