The German police late Saturday made a third arrest in the fatal knife attack that took place Friday at a street festival in the western city of Solingen. An official said they had ended the search for a suspect in the stabbing episode, which killed three and injured several more, some of them seriously.

“The one we’ve been looking for all day is just now with us in custody,” the official, Herbert Reul, the state interior minister of North Rhine-Westphalia, said in an interview Saturday with a German broadcaster.

He cautioned that the investigation was still in its early stages. “This is someone we’ve suspected to the highest degree, but of course everything still has to be checked,” Mr. Reul said. “This all just happened.”

The authorities had earlier arrested two people who were later determined unlikely to have been the real attackers, he told ARD, the broadcaster.

The person now arrested is believed to have lived in a refugee shelter, Mr. Reul said, adding that the motive was still under investigation. The police had found evidence linked to the attack along with the suspect, he said, without specifying what kind.

At a news conference held on Saturday before the arrest, officials said that they had not ruled out a terrorist attack because no other explanation for the seemingly random violence made sense. The federal prosecutor’s office is on standby to take over the case, should the authorities conclude that the attack was a terrorist act.