A man who went viral Tuesday for buying a Girl Scout troop's stock of cookies so they could get out of the cold was arrested the same day as part of a large-scale federal drug investigation.

A now-deleted Facebook post last week told an uplifting story: A man bought several boxes of cookies from Girl Scouts outside a Greenville, South Carolina, grocery store. When he finished at the store, and walked back into the 34-degree weather, he told the girls to pack up, the troop's cookie manager wrote in her post. He paid $540 to buy all the cookies so they could stop sales and get out of the cold.

Kayla Dillard, the cookie manager and a Girl Scout mom, told CBS News she didn't learn the man's name, but she took a photo of him and the girls.

"That man was just a very kind, sincere, and humble man who loves children," she told CBS News.

Her Facebook post was shared thousands of times, and on Tuesday, local and national media outlets also shared the story. South Carolina TV station WSPA managed to identify the man as Detric McGowan — then learned that he had been arrested by the Drug Enforcement Administration earlier Tuesday morning.

According to federal court records, arrest warrants for McGowan and nine other people were issued Feb. 19. McGowan was arrested on Tuesday and pleaded not guilty to eight felony drug and racketeering charges.

The DEA did not immediately respond to BuzzFeed News' requests for comment.

But the indictment against McGowan and his alleged conspirators was unsealed on Tuesday. He is accused of trafficking heroin and fentanyl, smuggling more than $1 million in cash, and renting a building to manufacture and store drugs, according to the indictment. In addition to arresting him, the DEA seized his family home.

When he was making his purchase from the Girl Scouts, McGowan said he owned several businesses and planned to take the cookies to work, CBS reported.

His attorney Janis Richardson Hall said he declined to comment on the criminal charges, given the ongoing case. But she added that his gesture toward the Girl Scouts was kindness with no other motive.

"In my opinion, he's a good-hearted person," she told BuzzFeed News.