The shooting occurred shortly before 4 a.m. near the 21000 block of Rimgate Drive, just south of Lake Forest Drive, according to the Orange County Sheriff's Department.
Earlier, around 2:30 a.m., the department received a 911 call from the boyfriend of a woman who said her ex-boyfriend was outside of their home in Rancho Mission Viejo, causing a disturbance, a sheriff's spokesperson told ABC7.
Deputies responded to the residence but the suspect was gone. Less than 90 minutes later, deputies located the suspect about 18 miles away from the original scene.
The suspect drove away and a brief pursuit ensued, authorities said. The man stopped and exited his vehicle, brandishing a gun and a knife, said sheriff's Sgt. Gerad McCann.
The armed suspect walked toward the deputies, who opened fire, McCann said. The man was struck by gunfire and transported to a hospital in critical condition.
No deputies were hurt in the confrontation.
The suspect's ex-girlfriend and her boyfriend were also unharmed.