“Folsom Prison Blues” gave Johnny Cash his first top-10 country hit in 1956, and his live concert performance at Folsom—dramatized memorably in the film Walk The Line—gave his flagging career a critical jump-start in 1968. But the prison with which Johnny Cash was most closely associated wasn’t Folsom, it was San Quentin, a maximum-security penitentiary just outside of San Francisco. San Quentin is where Cash played his first-ever prison concert on January 1, 1958—a concert that helped set Merle Haggard, then a 20-year-old San Quentin inmate, on the path toward becoming a country music legend.

Haggard was a product of Bakersfield, California, a hard-bitten Central Valley town that was the final stop for tens of thousands of poor, white farmers and laborers who migrated west during the 1930s, 40s and 50s seeking work in the factories, farm fields and oilfields of California. These Oklahomans, Texans and others referred to by the blanket term “Okies” brought with them a love of country music, and not just any country music, but “Loud music that plays until all hours,” as Wynn Stewart sang in his 1962 country hit “How the Other Half Lives.” Merle Haggard would eventually become an architect of the hard-driving, no-frills Bakersfield Sound, which shook the Nashville establishment in the 1960s. But not before he ran afoul of the legal establishment in ways that most country singers only sing about.

Haggard did his first stint in jail at age 11, when his mother turned him over to the juvenile authorities as “incorrigible.” As a teenager, Haggard went into jail at least three more times, and went out via escape at least once. In 1957, at the age of 18, Haggard was arrested on a burglary charge and sentenced to 15 years in San Quentin. He ended up serving only two years of that sentence, though, and he credits Cash with giving him the inspiration to launch a career after prison that included 38 #1 hits on the country charts, including “Sing Me Back Home,” “Okie From Muskogee” and “Today I Started Loving You Again.” Of Johnny Cash’s prison debut, Haggard said this: “He had the right attitude. He chewed gum, looked arrogant and flipped the bird to the guards—he did everything the prisoners wanted to do. He was a mean mother from the South who was there because he loved us. When he walked away, everyone in that place had become a Johnny Cash fan.”