(KTXL) — Folsom State Prison is one of the most famous California prisons, but the story behind it becoming the first in the world with electrically powered lights is little known.

Originally slated to be built in Rocklin, land owner Horatio Gates Livermore of the Natoma Land Mining Company was able to persuade the government to build the earliest maximum security prisons in Folsom along the American River, according to the California Department of Parks and Recreation.

Livermore offered 350 acres of his land along the river for the prison to be located and in exchange prisoner labor would be provided to build a dam about a mile up-river from the prison, according to Parks

When Livermore had made the deal with the State Prison Board in 1868 the family had already begun construction of the dam in 1867 and spent $119,000 building a two-mile railroad from Folsom to the dam site.

As the Livermore family was in the logging business they needed a dam above Folsom, at Stony Bar, to hold the logs, provide water to factories and irrigate farmlands.

The prison was completed in 1880 in order to ease overcrowding issues at San Quentin State Prison in the Bay Area, according to the Folsom Prison Museum.

It would not be until 1888 that a new deal was brokered between the newly formed Folsom Water Power Company and the prison that convict labor would be provided.

Under the new deal, the prison provided 60,000 man-days of convict labor over the course of five years 

In exchange, the prison was given use of the railroad and enough water from the powerhouse canal to the prison’s own powerplant that would go to powering the prison’s lights.

The dam and its canal would be completed in January 1893 and Folsom Prison would begin operating its powerplant shortly after. Making it the first electrically powered prison in the world.

Today the remains of Folsom’s first dam still sit on the banks of the American River where it is preserved by prison staff, but is not accessible to the public.