A woman who briefly escaped the custody of two undercover officers in San Diego had a seizure as they chased her down ... a wild scene that played out on camera.

It happened Saturday during protests near the San Diego County Jail. At one point, you see an unmarked, civilian-style car posted outside a gate to get inside ... when all of a sudden, a lady springs out from the back seat in shackles and makes a run for it.

She screams for help as she tries to escape, and people around her are clearly confused before they put it all together. Two men in plain clothes -- who are presumably law enforcement agents -- run after her and eventually catch up just a few yards away.

As they begin to apprehend her, a crowd forms around all of them with most everyone's camera whipped out and recording. Some people try yanking the men off of her, and at one point ... she's literally being pulled by the leg and hair in mid-air. It's horrifying to watch.

It gets worse though ... the woman goes into a full-blown seizure during all the chaos, and the two guys eventually give up and start walking back to their car. Everyone's asking them to identify themselves, but they refuse ... and simply leave the scene, hand on gun too.

Eyewitnesses say the woman was ultimately attended to by paramedics, but also say that SDPD showed up in riot gear to escort the ambulance she was taken away in.

Read more from our friends at TMZ