BALTIMORE — The second trial of a police officer charged in connection with the death of Freddie Gray began on Thursday and quickly pivoted to a basic question about police conduct: When does a lawful stop by a police officer turn into an unlawful arrest?

As the case against Officer Edward M. Nero opened in a windowless courtroom, it focused not on the death of Mr. Gray, the 25-year-old black man who sustained a fatal spinal injury in police custody last year, but on his arrest, with prosecutors contending that his rights were violated by police officers even before he was injured.

“The defendant’s conduct was not that of a reasonable police officer,” said a prosecutor, Michael Schatzow, who accused Officer Nero of failing to follow procedures designed to ensure Fourth Amendment protections against unlawful search and seizure.

“He deprived Mr. Gray of his liberty,” Mr. Schatzow added.

The death of Mr. Gray touched off this city’s worst riots since the death of the Rev. Dr. Martin Luther King Jr. and prompted the governor to call in the National Guard to patrol the streets, and it became an indelible part of the nation’s wrenching discussion over how the police use force against minorities.