Merle Haggard, one of the most successful singers in the history of country music, a contrarian populist whose songs about his scuffling early life and his time in prison made him the closest thing that country music had to a real-life outlaw hero, died at his home in Redding, California, on Wednesday, his 79th birthday.

His death was confirmed by his agent, Lance Roberts. Haggard had recently canceled several concerts, saying he had double pneumonia.

Few country artists have been as popular and widely admired as Haggard. Thirty-eight of his singles, including “Workin’ Man Blues” and the 1973 recession-era lament “If We Make It Through December,” reached No. 1 on the Billboard country chart from 1966 to 1987. He released 71 Top 10 country hits in all, 34 in a row from 1967 to 1977. Seven of his singles crossed over to the pop charts.

Haggard had an immense influence on other performers — not just other country singers but also ‘60s rock bands like the Byrds and the Grateful Dead, as well as acts like Elvis Costello and the Mekons, all of whom recorded Haggard’s songs. Some 400 artists have released versions of his 1968 hit “Today I Started Loving You Again.”

He was always the outsider. His band was aptly named the Strangers.

Unlike his friend Johnny Cash, Haggard didn’t merely visit San Quentin State Prison to perform for the inmates. Convicted of burglary in 1957, he served nearly three years there and spent his 21st birthday in solitary confinement.

Haggard went on to write “Mama Tried,” “Branded Man” and several other candid songs about his incarceration, all of them sung in a supple baritone suffused with dignity and regret. Many of his other recordings championed the struggles of the working class from which he rose. He became known as a poet of the common man.

Defying the conventions of the Nashville musical establishment, Haggard became an architect of the twangy Bakersfield sound, a guitar-driven blend of blues, jazz, pop and honky-tonk that traced its roots to Bakersfield, California, and that, in Haggard’s case, defined a body of work as indelibly as that of any country singer since Hank Williams.

In a 1999 interview with the magazine LA Weekly, Haggard cited Lefty Frizzell, Elvis Presley, Jimmie Rodgers, Chuck Berry and Bob Wills as among the artists who influenced his sound. “I thought, ‘If I combine all that, maybe I can come up with something sustaining,'” he said.

Haggard was fluent in a wide array of musical styles. In 1980 he appeared on the cover of Down Beat, a magazine whose main focus has always been jazz. His 2000 album, “If I Could Only Fly,” was issued on an imprint of Epitaph Records, a label associated with punk bands like Bad Religion and Rancid.

Much of Haggard’s cross-genre appeal was attributable to his versatile band, in which he sometimes played fiddle and lead guitar. But a great deal of it was also because of the pliancy of his singing voice, a deeply expressive instrument that lent itself to a variety of tempos, arrangements and emotions. He was as convincing singing about drinking and heartbreak as he was performing sentimental and devotional numbers, topical material and novelties.

Haggard was probably best known for his controversial hit “Okie From Muskogee,” a flippant broadside, released in 1969, that defended conservative heartland values against the hippie counterculture:

We don’t smoke marijuana in Muskogee

We don’t take our trips on LSD

We don’t burn our draft cards down on Main Street

We like living right and being free.

Haggard later expressed ambivalence about the song’s message. To prove that he was more open-minded than “Okie” suggested, he had hoped to release “Irma Jackson,” a paean to interracial love, as a follow-up. Instead his record company issued “The Fightin’ Side of Me,” a jingoistic anthem that proved more divisive than its predecessor.

“I was dumb as a rock when I wrote ‘Okie From Muskogee,'” Haggard told the Americana music magazine No Depression in 2003. He added, about a lot of the things he had said then, that, “I sing with a different intention now.”

Haggard wrote empathetically about poverty, and the Great Depression was often his muse. His late-1960s hit “Hungry Eyes” revisited the dignity-starved lives his parents led on arriving at California’s squalid Hoovervilles after fleeing the Dust Bowl in 1935:

A canvas-covered cabin in a crowded labor camp

Stands out in this memory I revive

‘Cause my Daddy raised a family there

With two hardworking hands

And tried to feed my mother’s hungry eyes.

Merle Ronald Haggard was born on April 6, 1937, in Oildale, California. His first years were spent in the abandoned boxcar that his

father, James, a railroad carpenter, had converted into a home for his family. James Haggard died of a stroke in 1946, after which Haggard’s mother, the former Flossie Mae Harp, a strict and pious member of the ultraconservative Church of Christ, took a bookkeeping job to provide for her three children.

Chafing against his mother’s yoke, young Merle got into trouble for breaking and entering, shoplifting and passing bad checks. There were repeated trips to, and escapes from, reform school. Rebellion and escape, themes steeped more in rock ‘n’ roll than in country music, would figure prominently in Haggard’s songwriting.

Few would see him as part of the rock ‘n’ roll tradition, but Haggard’s “fightin’ side,” as his 1970 hit put it, was a hallmark of a career that was defined as much by rock’s desire to break free of life’s constraints as it was by country music’s tendency to make peace with them.

In 1957, Haggard was arrested and charged with burglary and, by his account, considered fleeing from police custody with an inmate nicknamed Rabbit. The other man proceeded with the escape without Haggard and managed to elude capture until he was caught after fatally shooting a state trooper.

Convicted of murder, the man was sent to the gas chamber at San Quentin, and Haggard wrote a song for him, the death-row ballad “Sing Me Back Home.”

Haggard was paroled from San Quentin in 1960. He was granted a full pardon in 1972 by Gov. Ronald Reagan of California.

Haggard was already performing in public before he was sent to prison. He was just a teenager when Lefty Frizzell, his musical idol, invited him to join him onstage after hearing Haggard singing along with him from the audience.

After his release, Haggard performed in smaller bars in Bakersfield and later in larger rooms like the Blackboard, where he met Bonnie Owens, a cocktail waitress who had been married to country singer Buck Owens. A duet Owens and Haggard recorded, “Just Between the Two of Us,” reached the country Top 40 in 1964. They married in 1965.

The year before, Haggard had received his first big break when he was hired to play bass in the band of Wynn Stewart, an early exponent of the lean, hard-driving Bakersfield sound that Haggard and Buck Owens went on to make famous. Stewart also wrote Haggard’s first hit, “Sing a Sad Song,” a Top 20 country single released by the independent label Tally in 1963.

On the strength of one of that record’s successors, “(My Friends Are Gonna Be) Strangers,” written by Liz Anderson, Haggard moved to Capitol Records in 1965. There he began a long and fruitful partnership with the producer Ken Nelson, who also oversaw the recording careers of Buck Owens and Stewart.

Haggard later recorded for MCA, Epic and a number of other labels, reaching the country chart more than 100 times before radio stations, in the late 1980s, stopped playing his records in favor of those of a younger generation of artists. “That’s the Way Love Goes,” a duet with Willie Nelson, received a Grammy Award in 1985.

Haggard also appeared in several movies, including the 1980 Clint Eastwood film “Bronco Billy.” “Bar Room Buddies,” a duet with Eastwood from the film’s soundtrack, became a No. 1 country hit.

Haggard published two autobiographies: “Sing Me Back Home,” written with Peggy Russell, in 1981, and “Merle Haggard’s House of Memories: For the Record” in 1999. He was inducted into the Songwriters Hall of Fame in 1977 and the Country Music Hall of Fame in 1994. He received a Grammy Award for lifetime achievement in 2006 and a Kennedy Center award in 2010.

He recorded and toured extensively during the final two decades of his career, largely playing big theaters and casinos but also appearing at Bonnaroo, the wide-ranging annual music festival held in Tennessee, in 2009. He began spending increasing amounts of time with his family at his ranch near Lake Shasta in Palo Cedro, California, as well.

Survivors include his wife, the former Theresa Ann Lane; their children, Jenessa and Ben, who plays lead guitar in Merle’s band the Strangers; four children from his first marriage, daughters Dana and Kelli and sons Marty and Noel, both of whom are performers.

Though marked by greater stability than he had known earlier in his life, Haggard’s later years were not carefree. Never the shrewdest of businessmen, he was forced to file for bankruptcy in 1993 and to sell the copyrights to some of his songs to pay off his debts.

“I’ve been very bitter, and there’ve been times when I’ve been on the brink of closing down and walking away, disappearing into the woods,” he told LA Weekly in 1999. But he added: “I’m still writing good songs. I got a stack of stuff this high up at the house that’ll probably never be recorded.”