COLUMBIA, S.C. (AP) — A man who drove his car into mourners at the end of a graveside service at a South Carolina cemetery held a grudge against the state agency where the woman being buried had worked, authorities said Thursday.

Twelve people were hurt, and six of them remained in the hospital, one with a serious head injury, the woman's family said. Several suffered broken bones.

There was no evidence that James Kester knew Margaret Livingston, whose obituary said had worked more than 30 years as an administrative assistant at the Department of Mental Health, Columbia Police Investigator William Hilton said at Kester's bond hearing Thursday.

But Kester appeared quite familiar and angry with the agency, saying workers had kept him from his daughter for nearly two years.

"The Department of Mental Health wouldn't let me see my daughter for 600 days," Kester said at the hearing before the judge cut him off.

A death notice for Kester's 38-year-old daughter, Joy, was posted in The State newspaper in July 2016. She is buried at Greenlawn Cemetery in Columbia, the same cemetery that police said Kester drove his Cadillac to Wednesday afternoon.

Livingston's cousin Tammy Altman told reporters after the bond hearing that Kester came up to the family at the end of the service and asked if this was "Margaret's" funeral.

She said that was strange because her cousin went by Peggy. Then suddenly, Kester turned his car sharply right.

"He hit the gas and plowed just into the middle of where everyone was standing," Altman said.

She described the scene as chaotic. One person ended up on Kester's hood as he drove over grave markers and flowers, Altman said.

Kester appeared to be swinging back around to run over more people when his car stopped, she said.

"Fortunately, thank God, he hit a tombstone or either got bogged down into the dirt," Altman said.

Pictures from WLTX-TV's drone showed the car stopped amid dozens of markers and vases.

Kester, 64, is charged with 12 counts of attempted murder. His bond was set at $5 million and he did not have a lawyer at the bond hearing.

Police did not detail why Kester was upset with the mental health agency. Department spokesman Tracy LaPointe said the agency was checking on several employees who were at the funeral, but didn't appear to be physically injured.

"The Department will not issue a statement regarding the alleged perpetrator of the assault or comment on his alleged motives," LaPointe said in a statement, adding laws prevented officials from saying whether the department treated a person.

Several of Kester's relatives did not return phone messages.

Altman said several relatives had broken bones and the mental stress of having someone try to kill them for such a strange reason was almost as hard to bear.

"It was just so puzzling — so random to us," Altman said. "That part is so hard to understand."