A Chicago couple claims a failed social experiment involving their 3-year-old son led to the father's arrest and the boy being taken away from them.

The boy was sent by the Illinois Department of Children and Family Services to live with a relative for more than three weeks. But on Wednesday the department announced he has been returned the the family.

"We're still investigating," department spokesman Neil Skene told NBC News.

Laura Quijano and Boguslaw Matlak told police that they were trying to understand public reaction to child endangerment when they turned on a hidden camera and filmed Matlak placing their son in the trunk of their car, which was parked outside of a restaurant in Norridge, a suburb of Chicago.

"You are being bad and I'm going to punish you by putting you in the trunk," Matlak yelled at his son after putting him in the trunk, witnesses told police.

The temperature outside was 89 degrees, according to a Norridge Police Department report.

"I was thinking maybe I should do a video to show people that they should do something about it when they see something wrong, to get involved," Matlak told NBC Chicago of the Sept. 2 incident.

Boguslaw Matlak was arrested for what he says was a hidden camera experiment. Village of Norridge

Three people sitting near where the Audi was parked outside of a Panera Bread told the responding officer that after closing the trunk, Matlak immediately got into the car and drove away.

The officer later recognized Matlak when the father returned to the parking lot without his wife and child.

Matlak told the officer that he was conducting a social experiment in hopes of becoming an "internet sensation." Matlak said he had done the same trunk bit with his child twice before, and no one had reacted.

The officer checked on the boy, who was with his mother, and saw he was safe. Quijano told him the back seat had been folded down and she was able to grab the boy from the inside of the car and place him in his car seat after his father put him in the trunk.

The police report said witnesses said they didn't see the boy in the back seat as the car pulled out of the parking lot.

Boguslaw Matlak places his son in the trunk of his car during what he said was a hidden camera experiment. via NBC Chicago

Matlak was arrested and charged with endangering the life of a child. The police report said his version of events changed several times during questioning, and officers found a recording device on Matlak's body. He told officers that he was an "informant for the Cook County State Police," the report said.

On Wednesday, Skene, with the Illinois Department of Children and Family Services, said in a statement that "the parents agreed not to use the child in social experiments."

Rina Infelise, Quijano's attorney, told NBC News that the boy was returned late Tuesday. She also defended the pair's story as consistent: "From what I know the story has always been the same — it was a social experiment."

"There were five cameras used," she said. "It was pretty planned out."