When Toby Keith befriended legendary actor and filmmaker Clint Eastwood on a central California golf course, he wasn't looking for songwriting material -- but the fact that his latest track, "Don't Let the Old Man In," grew out of a conversation the two had should come as no surprise. Keith has long taken lyrical inspiration from casual exchanges and off-the-cuff reactions from the people around him.

"[Eastwood] is kind of a mascot at Pebble Beach, so I had been seeing him around, but ... the first few times I was around him, I didn't approach him," Keith explained at a recent press conference. "As it went on, he kinda started coming up and speaking, and he puts the room at ease, so we became friends."

Eastwood invited Keith to be his golf partner during a three-day tournament at Tehama, the filmmaker's Carmel, Calif., property and golf club. As they spent more time together, the two men started discussing their lives and upcoming projects. "Walking off the marina, he turned and said, 'I turn 88 on Monday,' and I said, 'What are you going to do?' and he said, 'I'm going to shoot a movie,'" Keith recalls with a laugh.

"So I go, 'What keeps you going?'" the country star continues. "He goes, 'I get up every day and don't let the old man in.' I said, 'I'm writing this down right now.' Of course, over the three days of playing, he told us what the movie was about. I didn't ask him if I could put a song [in the movie], I just went home and wrote it, sent it to him and hoped that he would consider it. And, you know, he did."

The film, called The Mule, tells the story of an older man who becomes an unintentional drug courier; it is the first movie that Eastwood will star in and direct since 2009's Gran Torino. "Don't Let the Old Man In," which will be featured in the movie, addresses the storyline, but also grapples with the aging process more generally, and is in many ways a tribute to Eastwood's experience fending off old age through art and work.

"I knew who I was writing it for, and who inspired me to write it, and I wanted to deliver him the best thing I could," Keith adds. "And I knew that the song could be powerful."

The country star worked tirelessly on the song until it was finished. "I was consumed with it for about a day and a half. I mean, I was short on phone calls. I didn't hear any conversations. I could not quit working on it," Keith recalls. "I was pretty much a zombie for about two days."

When it was finished, Keith admits, he felt a huge weight lift off his shoulders. "The second I wrote it, it was like I had jumped 500 feet in the air. You know what I mean? It was like, 'Oh man, I had such a load on me with this.' I knew I had accomplished what I wanted to accomplish," he says.

In fact, Keith continues, writing the song -- and collaborating with such a legendary figure -- gave him a new perspective on what might be ahead for him in his already accomplished career. "Honest to God, this Clint Eastwood thing made me get a bigger bucket," he relates, speaking metaphorically. "I felt like my bucket was full, and I couldn't want for anything. I'm so blessed.

"[Writing this song] was one of my favorite things I ever did in my life," Keith adds.

Toby Keith + More Country Stars' First Tweets

How Well Do You REALLY Know Toby Keith?