Two officers were shot in front of the Ferguson Police Department early Thursday while demonstrators were gathered across the street — an attack the county police chief described as “an ambush” that could easily have killed both men.