A San Francisco Bay Area public transit officer who was shot and killed by a fellow officer while searching an apartment was looking for a laptop and related items that had been stolen, the transit agency police chief said Wednesday.

However, Bay Area Rapid Transit Police Chief Kenton Rainey declined to disclose any further details about how Sgt. Tom Smith was shot on Tuesday, deferring those questions to the Alameda County Sheriff’s Office, which is investigating the shooting.

Rainey said at a news conference that there were seven BART officers and a sheriff’s deputy at the scene when the shooting occurred. A robbery suspect was in custody, and the officers were searching his apartment in Dublin as part of an investigation into the theft of BART property.

Investigators were trying to determine whether an officer’s weapon discharged accidentally, or if Smith was mistaken for someone else, Alameda County sheriff’s Sgt. J.D. Nelson said. Either way, it was an accident, he added.

Five of the seven BART officers were detectives in plainclothes, including Smith, according to Rainey, who said the officers were following agency policies and training. He declined to name the officer who shot Smith, but said he was “extremely upset.”

“We want to give him and his family a chance to come to grips with what’s going on and what’s happening,” he said.

Smith, 42, of San Ramon had been with the department for 23 years and was in charge of the detective unit. He is survived by his wife, also a BART officer, and 6-year-old daughter.

“Tommy was a great law enforcement officer, but an even better son, brother, husband, father and friend,” Rainey said. “He touched many lives in a positive way both professionally and personally and he will be sorely missed.”

Nelson said the officer who shot Smith has been in law enforcement for more than 10 years. The officers knew the suspect was in custody and not home at the time of the shooting, Nelson said.

The suspect’s name has not been released.

The officers involved in the search wore bulletproof vests and began the search by knocking twice on the door, Nelson told the Associated Press. The knocks went unanswered, but the door was unlocked, so several officers stepped inside with guns drawn, he said.

What happened next remained unclear, but Nelson said an officer fired one shot.

Smith was taken to Eden Medical Center in Castro Valley, where he died. Authorities said he was the first on-duty fatality in the 42-year history of BART police.

Television reports showed lines of officers outside the hospital saluting as their fallen comrade’s body, draped in a large American flag, was loaded into a coroner’s van.

BART police have been the center of other controversies, among them the fatal shooting on New Year’s Day 2009 of Oscar Grant III, an unarmed black BART passenger who had been detained at the Fruitvale station after reports of a fight.

Officer Johannes Mehserle, who is white, was convicted of involuntary manslaughter and sentenced to two years minus time served.

An independent auditor said last month that BART police have made significant progress in meeting reforms instituted after the death of Grant. including increased officer training about bias and other issues, along with better reporting about incidents involving use of force.