MIDLAND CITY, Ala. — A six-day standoff between an angry and violent survivalist who held a 5-year-old boy hostage in an underground bunker and a legion of local, state and federal law enforcement officials ended on Monday with the death of the kidnapper and the freeing of the boy.

Stephen E. Richardson, the special agent in charge of the F.B.I.’s division in Mobile, told reporters that the boy, named Ethan, was rescued at 3:12 p.m. and that he “appeared physically unharmed and is being treated at a local hospital.” Mr. Richardson added, “The subject is deceased.”

The subject was 65-year-old Jimmy Lee Dykes, who boarded a school bus last Tuesday afternoon, killed the driver and took the boy into a bunker he had installed in his backyard.

Neighbors speculated that Mr. Dykes had kidnapped the boy as part of a scheme to air his thoughts and grievances on a larger platform, and at a news conference earlier Tuesday, Sheriff Wally Olson of Dale County acknowledged that to be a major motive.