Jerry Jeff Walker in 2005. (Jack Plunkett/AP)

Jerry Jeff Walker was singing in New Orleans coffeehouses and on street corners in 1965, when he was thrown in jail for public intoxication. It wasn’t the first time he had been drunk, and it certainly wouldn’t be the last, but as he sobered up, he heard his cellmate tell him a story that would change his life.

He was an old man with years of sorrow behind him, a homeless street performer who had once been a dancer “at minstrel shows and county fairs throughout the South.”

Like Mr. Walker, he didn’t go by his real name. He said he was called “Bojangles,” after Bill “Bojangles” Robinson, a renowned vaudeville and film dancer who died in 1949.

Mr. Walker used the encounter as the basis for his song “Mr. Bojangles”:

I knew a man Bojangles and he’d dance for you

In worn-out shoes

Silver hair and ragged shirt and baggy pants

The old soft shoe

Mr. Walker recorded the song in 1968, but it did not become a hit. By the early 1970s, with four albums and 10 years of struggle, he was ready to give up on the music business. He was leaving New York and was on his way to Florida for a fresh start.

“A friend of mine was driving and I was asleep in the back seat,” he told the Richmond Times-Dispatch in 1994. “Somewhere in South Carolina, he woke me up and asked me didn’t I write that song ‘Mr. Bojangles.’ I said yeah, and he said, ‘I tell you what. For the last couple of hours it’s been on this station, and this one, and this one.’ He hit the button, and there it was again.”

The Nitty Gritty Dirt Band recorded a version of “Mr. Bojangles” that reached No. 9 on the Billboard pop chart in 1971. It soon became recognized as a standard and was recorded by artists as varied as Nina Simone, Harry Belafonte, Dolly Parton, Sammy Davis Jr., Bob Dylan, Whitney Houston and George Burns.

Mr. Walker, who went on to become a formative figure in what is known as “Texas outlaw” music and more generally Americana music, died Oct.?23 at a hospital in Austin. He was 78.

He had complications from throat cancer and other ailments, said his wife, Susan Walker.

For years, Mr. Walker had a reputation as a hard-living, rough-edged performer who drank heavily, used drugs and partied all night. He was also known for his generosity, helping to launch the career of Jimmy Buffett and performing the songs of other writers.

Mr. Walker called himself a “Gypsy Songman” — the title of both an early song and his 1999 autobiography. One of his first albums, “Driftin’ Way of Life,” was something of a musical self-portrait, as he wandered from Greenwich Village, where he was part of the same folk music crowd as Dylan and Joan Baez, to New Orleans to Key West, Fla. He rode a motorcycle across Canada, then was on his way to California when he stopped in Austin in 1971 — and stayed for good.

The Austin outlaw music scene he helped launch came to include Willie Nelson, Waylon Jennings and Townes Van Zandt. Mr. Walker formed a group called the Lost Gonzo Band, evoking the untamed spirit of “gonzo” journalist Hunter S. Thompson.

In 1973, he and his band released the album “Viva Terlingua,” which has influenced generations of country and roots musicians, from Lyle Lovett and Steve Earle to Lucinda Williams and Robert Earl Keen. Recorded in the virtual ghost town of Luckenbach, Tex., “Viva Terlingua” practically defined the new Texas sound, combining elements of country, rock and folk music with a touch of sagebrush poetry.

Mr. Walker contributed five songs to the album, including “Wheel,” a heartfelt ballad about the death of his grandfather. The best-known songs, though, were by other writers, including Guy Clark’s cinematic “Desperados Waiting for a Train,” Ray Wylie Hubbard’s honky-tonk anthem “Up Against the Wall Redneck Mother” and Gary P. Nunn’s “London Homesick Blues,” about a Texan stranded in England who longs “to go home with the armadillo, good country music from Amarillo and Abilene.”

By the late 1970s, Mr. Walker’s life of constant excess was catching up to him. He owed hundreds of thousands of dollars in unpaid taxes, and his second marriage was about to fall apart. He cut back on the drugs and drinking and took up exercise, often bicycling with his children. Instead of traveling with an entourage on a private jet, he gave solo performances in small, intimate settings.

“I did set out to be a little notorious,” he told the Houston Chronicle in 2005. “I always thought that people would be interested in my music if I appeared to be an interesting person.”

Mr. Walker was born Ronald Clyde Crosby in Oneonta, N.Y., on March 16, 1942. After the death of his father, young Ronnie and his mother lived with his grandparents. He was in his teens when he saw his grandfather’s death in a farming accident.

Almost everyone in the family played a musical instrument. His aunt, a jazz pianist, gave him his first guitar when he was 13.

After high school, he briefly served in the National Guard, then went AWOL — he was ultimately discharged — before going to New York to play folk music. He eventually began to use the stage name of Jerry Ferris and later Jeff Walker before blending them to become Jerry Jeff Walker. He legally changed his name in the late 1960s.

Mr. Walker’s first marriage ended in divorce. Survivors include his wife (and manager) since 1974, the former Susan Streit of Austin; their two children, Jessie Jane McLarty and musician Django Walker; a sister; and two grandchildren.

Mr. Walker, who performed at the 1993 inauguration of President Bill Clinton, released more than 30 albums, the most recent of which was “It’s About Time” in 2018. Of the dozens of songs he wrote, none has had the staying power or emotional resonance of “Mr. Bojangles.”

He said he was reading the poetry of Dylan Thomas and was conscious of using internal rhyme. He strummed a descending chord figure in the lilting time signature of 6/8, and the words and music came together.

“I just had my guitar, a yellow pad, and the memories of guys I’d met in drunk tanks and on the street — one gentle old man in particular,” Mr. Walker told Texas Monthly magazine in 2004. “It was a love song.”

The origin story behind the song is true: Mr. Walker kept his arrest record to prove that he was held for several days in a New Orleans jail, where an aging dancer told him about his life:

He looked to me to be the eyes of age

As he spoke right out .?.?.

He said the name Bojangles and he danced

A lick across the cell .?.?.

He spoke with tears of 15 years how his dog

And him traveled about

His dog up and died

He up and died

After 20 years he still grieves

He said I dance now at every chance in honky-tonks

For drinks and tips

But most the time I spend behind these county bars

’Cause I drinks a bit

He shook his head and as he shook his head

I heard someone ask please

Mr. Bojangles .?.?. dance.

Many people assume that the dancer described by Mr. Walker was African American, like Bill “Bojangles” Robinson, but that was not the case. In his autobiography, Mr. Walker noted that because the jails were segregated in New Orleans in 1965, the Bojangles he met was an elderly White dancer down on his luck.

The song has been interpreted by countless musicians, and Mr. Walker sang it at most of his performances. One of his proteges, singer-songwriter Todd Snider, recalled a night when he and Mr. Walker were the last customers at a bar in Santa Fe, N.M.

After it closed, they were walking down a street at 2?a.m. when they heard someone play the opening chords to “Mr. Bojangles” on a banjo.

“This was a bedraggled guy, not a kid,” Snider wrote in his book, “I Never Met a Story I Didn’t Like.” “A homeless guy, kind of crazy looking, with a harmonica around his neck, his hat on the ground in front of him, and nothing in the hat .?.?.

“The guy looked up at us. He didn’t know Jerry Jeff Walker was standing there. He may never have heard of Jerry Jeff Walker.”

They listened as the man sang Mr. Walker’s masterpiece about a down-and-out street performer, “and I could feel us both getting choked up,” Snider wrote.

He wondered if he should say something, “but no, I figured if Jerry Jeff wanted to let the guy know who he was, he’d tell him.”

The only thing Mr. Walker said was: “That sounded great.”

He took all the money out of his pockets, put it in the street singer’s hat, then walked away. He never told him his name.