DUBLIN -- A BART police officer was fatally shot by a colleague while conducting a probation search Tuesday afternoon at an apartment in Dublin -- the first officer killed in the line of duty in the transit police department's 42-year history, authorities said.

The shooting occurred at around 2 p.m. while BART and Dublin police officers were at an apartment complex in the 6400 block of Dougherty Road, said Sgt. J.D. Nelson of the Alameda County Sheriff's Office.

While inside the apartment, a BART officer fired one shot, wounding a fellow male officer, who later died at a hospital, Nelson said. Details of what led to the shooting were not immediately released.

Late Tuesday, the Alameda County Coroner's Office confirmed that the slain officer was Sgt. Tom Smith, Jr., a 42-year-old veteran with more than 20 years of experience in law enforcement. The officer who fired the fatal bullet had more than 10 years on the force.

Nelson said the officers were wearing bulletproof vests at the time of the shooting; he did not say where on his body the slain officer was struck.

"This is a shocking thing for a BART officer to be killed in the line of duty," said elected BART Director Gail Murray of Walnut Creek. "But like all peace officers, our BART police risk their lives when they go out to work in the stations and cities. We feel very saddened for the family, who would not expect this to happen to their loved ones."

The officers were there to serve a warrant for a suspect who was wanted in connection with several robberies that took place on BART property, Nelson said. Officers knew that the suspect, whose name was not released, was in custody at the time, he added.

When police knocked on the apartment's door, no one answered; police knocked again, found that the door was unlocked and entered the apartment. Not knowing whether anyone was inside the apartment, the officers followed protocol and entered with their guns drawn, Nelson said.

Rosalia Vazquez, who lives several doors down from where the shooting happened, said she wasn't home at the time. She said she knew something had happened because the apartment door was barricaded.

"It's pretty quiet usually, it's the reason i moved here," Vazquez said. "I'm just in shock, I can't imagine this happening."

She said she has lived at the complex for 10 months and did not know who lived in the apartment where the shooting was.

Officials said that BART police Chief Kenton Rainey and BART General Manager Grace Crunican visited the slain officer's family to offer their condolences and support. Rainey and Crunican added in a joint statement: "The entire BART organization is deeply saddened by this tragic event and we ask the public to keep the officer's family in its thoughts and prayers."

The slain officer's body was removed from the hospital late Tuesday in a casket draped in an American flag. Dozens of police officers stood in salute as the casket was loaded into an Alameda County Coroner's van.

The last time a police officer in Alameda County was killed in a friendly-fire incident was in January 2001, when two Oakland police officers shot and killed an undercover detective.

Officer William Wilkins was pursuing an auto thief near 89th Ave when officers Andrew Koponen and Timothy Scarrott arrived as Wilkins drew his weapon on the suspect. Both officers fired several times, killing Wilkins, after they said he ignored orders to drop the weapon.

The Dublin Police Department has taken over the investigation into Tuesday's shooting, and officers who took part in the search were being questioned, according to authorities.

Staff writers Denis Cuff, Matt O'Brien, Lisa Vorderbreuggen and Thomas Peele contributed to this report.