Four people taken hostage by a gunman at a pharmacy overpowered their captor Monday after he demanded prescription drugs and fired several shots, authorities said.

The 90-minute standoff ended when the hostages, who were barricaded inside the store with the gunman, hit him with something, Sheriff's Deputy B.E. Ferrell said.

None of the hostages was harmed, but the suspect was taken to a hospital, Ferrell said. The nature of his injuries was not immediately clear, but a witness said he had taken a painkiller and an anti-anxiety drug.

Crack the case in FOXNews.com's Crime Center.

The gunman arrived with a handgun and a sawed-off shotgun, taking six people hostage at the Family Discount Pharmacy in Stollings, about 60 miles southwest of Charleston, according to Logan County 911 Director Marilyn Crosby.

Pharmacy technician Jessica Thompson, 24, said the gunman said he needed drugs but could not afford to buy them.

The man told the hostages that he wanted to kill himself but did not want to hurt them, Thompson said. He was given an unknown quantity of Lortab, a painkiller, and Xanax, an anti-anxiety drug, which he took, she said. He then became drowsy.

Workers told the man there were more drugs in an adjacent building, Thompson said. She told the suspect she was going to get the keys to the other building but ran for help instead.

"I was just afraid he would hurt the rest of them that were in there," she said. Another worker in the store also escaped after a similar ruse.

Authorities identified the gunman as Jeffrey Harvey, 31. They did not release details about the last four hostages or how they overpowered him.

Visit FOXNews.com's Crime Center for complete coverage.