“Thus far, a terrorist motive is being strongly considered,” the national police said on Tuesday.

“The reason for this, among other things, is a note found in the getaway car,” they said, without elaboration. “Other motives aren’t being ruled out. These are being investigated as well.”

The shooting jarred a country where gun violence is rare, and where there has not been the kinds of major terrorist attacks that have rocked Belgium, Britain, France and Germany in recent years. It came just days after a gunman, thought to be a white nationalist, killed 50 people at two mosques in Christchurch, New Zealand, prompting fears of either copycat attacks against Muslims or retaliatory attacks by them.

The police said on Tuesday that they had found a firearm when Mr. Tanis was arrested. They did not say what kind of gun it was, or whether it was the weapon used in the attack.

Mr. Tanis had been arrested several times before and was facing a rape charge. People who knew him from the Kanaleneiland neighborhood of Utrecht, home to many immigrants from Turkey and Morocco, described him as erratic, troubled and aggressive.

Bart Nitrauw, a spokesman for the local prosecutor’s office, said in a phone interview: “We can’t say anything about what was in the letter, just that it was one of the reasons for the suspicion of a terror motive — the letter in the car, and what we found at the place where the suspect was arrested.”