A photograph of a candle in memory of fallen police officers and other images of racial solidarity appeared on the Facebook page of a Missouri man on Saturday afternoon.

Hours later, the man was dead, after a Facebook exchange between the man and a police officer over the Black Lives Matter movement turned into a fatal face-to-face encounter, a relative said.

The St. Louis County Police Department said that on Saturday, just before 6 p.m., the man, Tyler Gebhard, 20, broke into the house of a relative of one of its officers, who shot him. Mr. Gebhard had “made a series of threats” before going to the house, the police said. “These threats were from the suspect to the family as well as uninvolved members of the community.”

The police did not give details about the threats. But Mr. Gebhard’s uncle, Patrick Brogan, said that the two were friends on Facebook and that they had clashed recently online over Mr. Gebhard’s support of Black Lives Matter, The St. Louis Post-Dispatch reported.