Two other men, Daniel P. Borden and Tyler Watkins Davis, were arrested in connection with the beating. Mr. Davis will face his trial later this year, and Mr. Borden pleaded guilty and awaits sentencing in October, according to court records.

On Tuesday, Mr. Preston, a Maryland man described as an imperial wizard of the Ku Klux Klan, was sentenced in Charlottesville Circuit Court to four years in prison for firing a gun during the rally, the records show. As in the case of the garage beating, footage of Mr. Preston’s shooting also spread online, and amateur sleuths set out to identify the assailant.

In the video, released by the American Civil Liberties Union of Virginia, Mr. Preston was shown pulling out a handgun, and firing at the ground in the direction of a black counterprotester, Corey A. Long, 24. At the time, Mr. Long was igniting a can of spray paint that a protester had thrown, turning it into an improvised flamethrower.

Joseph Platania, the commonwealth’s attorney, said in an email statement on Thursday about Mr. Preston’s Tuesday sentence: “After careful consideration of the evidence presented, the Commonwealth feels that Judge Moore imposed a fair and just sentence for the choices Mr. Preston made on August 12, 2017.”

Image Alex Ramos was sentenced to six years in prison for participating in the beating of a black man in a garage at the white nationalist rally last year. Credit... Monroe County Sheriff's Office, via Associated Press

He was not immediately available to comment on Thursday’s sentences.

No one was injured by the shot that Mr. Preston fired. The American Civil Liberties Union of Virginia submitted the video to the F.B.I. and the local police.

Mr. Preston, from Baltimore, was arrested on Aug. 30, 2017, and charged with discharging a firearm within 1,000 feet of a school, a crime punishable by two to 10 years in prison.

