A suspect in the slaying of a police officer during a doughnut shop robbery was apprehended early Tuesday at a homeless shelter in Florida, police said.

John Lewis, 21, was captured in Miami after investigators learned he had boarded a bus for Florida during the weekend, police said. A 911 call and workers at the Miami Rescue Mission alerted Florida authorities he was there, Miami Police Chief John Timoney said.

Lewis is suspected of shooting Officer Chuck Cassidy during an armed robbery at a Dunkin' Donuts. The 54-year-old died Thursday, and was the third Philadelphia officer shot over four days in separate attacks. The other two officers survived.

Philadelphia Police Commissioner Sylvester Johnson said he was relieved that Lewis' arrest did not lead to more violence. Police had considered Lewis armed and dangerous.

"That was my greatest fear — someone else being hurt, either because of him, or by him," Johnson said at a news conference.

Lewis was being questioned by Miami police, and Philadelphia police detectives were on their way to Florida, said Timoney, a former Philadelphia police commissioner. He was expected to be charged and make a court appearance in Philadelphia, Miami police said.

Witnesses to Cassidy's shooting have said a gunman entered the doughnut shop and demanded money just before the policeman opened the door. The man spun around and shot Cassidy before the officer could react, they said.

Portions of a videotape released by police showed a hooded robber grabbing the fallen officer's pistol as he fled.

Johnson has said one of two weapons officers recovered at a Philadelphia home may be the weapon used to kill Cassidy.

Lewis was arrested in 2005 on drug charges and placed in a treatment program that he completed in February. The drug charges and a 2006 attempted theft charge were then withdrawn. In June, he was again arrested on drug charges; that case is pending.

A private viewing for Cassidy was scheduled Tuesday, with a public viewing and funeral service scheduled downtown on Wednesday.