The private sanitation truck that crushed several cars in Brooklyn on Wednesday — leaving two people injured — had collided with a New York City Sanitation Department street sweeper moments before overturning.

Video posted on Twitter shows the broom crossing the intersection of Flushing and Nostrand avenues in Williamsburg around 3:45 a.m.

The cleaning machine goes to make a left turn when it collides with the green Viking Sanitation truck, according to the footage, posted by Williamsburg News.

The crash seemingly caused the garbage truck to flip over and flatten multiple parked cars.

A Dept. of Sanitation spokesman said it was the private garbage hauler that hit their sweeper after running a red light.

A sanitation worker received a minor shoulder injury and has since been treated and released from the hospital, the department spokesman said. Another person was also injured and taken to Woodhall Hospital, the FDNY said earlier.

A rep for Viking Sanitation told The Post they are awaiting the results of the NYPD’s investigation into the crash.

A truck from the same private sanitation company was involved in a chain-reaction crash in Brooklyn in June 2018, when its drunk driver careened into several parked cars and a tree before coming to a stop on the front lawn of a Borough Park home.