A Virginia State Police trooper on a training exercise for a criminal interdiction squad was killed and two civilians were wounded when a man the officer had just begun to question opened fire Thursday afternoon inside a Greyhound Bus Station near downtown Richmond, authorities said.

Two troopers shot and killed the gunman, police said.

The state police superintendent, Col. W. Steven Flaherty, identified the slain trooper as Chad P. Dermyer, 37, who graduated from the academy in 2014 after serving as an officer in Jackson, Mich., and in Newport News, Va.

Flaherty learned of the shooting while attending an event honoring police officers killed in the line of duty and as candles were being lighted for those lost. He later announced the death “with an in­cred­ibly heavy heart” and noted that Dermyer is survived by his wife, Michelle, and two children. The slain trooper grew up in Michigan, served in the Marine Corps and most recently lived in Gloucester, Va.

Dermyer’s brother John called him “my best friend’ before being overcome by emotion during a brief telephone interview Thursday night. His wife, Jennifer, remembered her brother-in-law as “giving” man, whose death was “heartbreaking.” She described him as a “loving brother, father, son and uncle. He was very involved with his son and daughter. He was a happy guy who died doing what he loved.”

WVEC 13 anchor LaSalle Blanks honored Chad Dermyer, a Virginia State Police officer who was killed when a gunman opened fire at a Greyhound bus station on Thursday. Dermyer rescued a dog in January that had been unning between cars on Interstate 64 and Interstate 664 in Virginia. (WVEC 13)

Reva Trammell, a Richmond City Council member, hugged a crying state trooper at the shooting scene and called Thursday “one of the saddest days I’ve ever seen in the city of Richmond. A senseless act in the city. Cruel.”

Police said the two civilians suffered injuries that did not appear life-threatening. One of the victims is a member of the Binghamton University track team who was on her way to a meet, school officials said.

Flaherty withheld the name of the shooter pending notification of relatives. He said a gun was recovered. He said that the man was not from the Richmond area and that he had an arrest record but was not being sought.

The shooting occurred about 2:45 p.m. in an area that the city has tried to revitalize, an area known as the Diamond after the nearby minor league baseball stadium.

Flaherty said Dermyer and other troopers were at the station to train for what is called a counterterrorism and criminal interdiction unit. The unit is assigned to public transit areas and highways to identify and question people deemed suspicious. It is a way of intercepting drugs and guns.

Dermyer, wearing a dark blue uniform that resembles fatigues, had started to question the man when the assailant pulled out a gun and shot the trooper, police said. Dermyer was not wearing a protective vest.

Flaherty said the conversation lasted about 30 seconds. He said he did not know what drew Dermyer’s attention to the man. Two other troopers returned fire, police said. Flaherty said the squad’s training assignment was: “ ‘If you see some suspicious behavior, go over and engage and have a conversation.’ That was what was taking place here.”

A Virginia State Police trooper was killed in a shooting at a Richmond bus station on Thursday afternoon and the suspected gunman was fatally shot, a state police spokeswoman said. (Reuters)

The police superintendent said investigators had not identified a motive.

Flaherty said Dermyer’s colleagues “have taken this very hard because of how well he was liked. Former Marine, you know the type, the demeanor that he had and the professional image.” In January, Dermyer and a fellow trooper, Jeremy Hagwood, chased down a pet dog named Pinta who got loose and ran in traffic on two Virginia highways, according to local news accounts.

Thursday’s shooting in Richmond came after recent attacks in the Washington area that claimed the lives of four law enforcement officers in Maryland and Virginia.

Two sheriff’s deputies were fatally shot 30 miles northeast of Baltimore in early February by a man suspected of shooting his ex-wife in the late 1990s, followed that same month by the fatal shooting of a Prince William County officer responding to a domestic disturbance call on her first day of patrol.

On March 13, a Prince George’s County police officer was killed in a shootout with a gunman who police said wanted to die in a gun battle and had brought two brothers along to videotape the encounter. The plainclothes officer was killed by a fellow officer who mistook him for a suspect, police said.

Thursday’s shooting prompted the closure of the bus terminal.

Gov. Terry McAuliffe (D) called the death “senseless” and described Dermyer as a “husband, a father and a hero who was taken from us too soon.” Flaherty said that while at the remembrance ceremony, he had been thinking of the 28 police officers killed this year across the country.

“I had just thought to myself, ‘Twenty-eight is the biggest number we’ve had in a long time,” Flaherty said. “ ‘I hope and pray that next year we don’t have 28’ — not knowing that in just a few seconds out here Chad . . . ”

His voice trailed off as he mentioned Dermyer’s name.

Hermann reported from Washington. Victoria St. Martin in Washington contributed to this report.