A Wisconsin man who vanished two weeks before he was supposed to stand trial on child sexual assault and child pornography charges was hiding out for more than three years in a makeshift bunker concealed in the wooded, remote northern part of the state, officials said.

The Portage County Sheriff's Office posted on Facebook that 44-year-old Jeremiah Button was taken into custody Aug. 9.

Earlier that day, Thomas Nelson of Wausau told WSAW-TV he ventured inside a bunker with a log door carved into an embankment that he first spotted several months ago. The mysterious hideaway was on state land in the township of Ringle, west of Wausau, located about 145 miles north of Madison, the state capital.

"I followed the brush marks, I saw the door. I couldn't get out of there fast enough," he told the television station about the first time he saw the bunker.

WANTED TENNESSEE INMATE WAS CAUGHT AFTER BEING SPOTTED RIFLING THROUGH STRANGERS' REFRIGERATOR

Nelson, a frequent hunter, told WSAW-TV the bunker's entryway was unlatched on Friday morning, so he went inside. That's when he made contact with Button, who disappeared in February 2016.

"I pushed the door open, and I look inside and I can see canned foods, there are little storage boxes, and I'm like...I gotta go in," he told the television station. "I come around the corner a bit and there he is, laying in his bed."

Nelson then contacted the police and guided them to the bunker, where a 20-minute standoff ensued before the 44-year-old surrendered. Portage County Sheriff Mike Lukas told the Stevens Point Journal the shack was camouflaged amid trees in the secluded area.

Kecker said Button told deputies he had been building the bunker while his case was moving through court, and continually stocked it with items he found in the Marathon County landfill.

TENNESSEE INMATE CURTIS WATSON CAPTURED AFTER 5 DAYS ON RUN, OFFICIALS SAY

Sheriff's Lt. Jeff Stefonek told WSAW-TV that Button set up solar panels on the bunker's roof to power LED lights, radios, cooling fans and all manner of electronic equipment. He also had a pedal-powered generator for cloudy days.

The bunker was small enough that it stayed warm in winter and cool in summer. He also had built a water-filtering system.

"He was not only surviving, but thriving in this structure through all of the different supplies he was able to find," Stefonek told the television station.

CLICK HERE FOR THE FOX NEWS APP

Button told deputies he never left the area, according to WSAW.

Button is back in custody on a $100,000 cash bond and is due back in court for a pre-trial conference on Sept. 16. His attorneys, public defenders Anne Renc and Jessica Phelps, didn't immediately return phone messages to the Associated Press on Wednesday. Court records obtained by the AP show they were assigned to Button's case on Tuesday.

The Associated Press contributed to this report.