WASHINGTON — Sen. Orrin Hatch, the conservative Utah Republican, has written hundreds of songs on patriotic themes — with such titles as "Freedom's Light" and "I Love Old Glory" — as a way of paying tribute to his country.

But his latest trip down Tin Pan Alley had an even more personal resonance: Hatch said he was asked by several colleagues to put down his feelings about a very close friend who is facing a serious illness. The friend is the legendary liberal Ted Kennedy, and the colleagues are Democrats who envision having the song played as a tribute to Kennedy at next month's Democratic convention — and as a living example of a brotherhood that transcends party lines.

The result, "Headed Home," is a lilting ballad that even its author can't repeat without tearing up. The lyrics, he said, refer to Kennedy's heroic return to the Senate where Kennedy has served for almost 46 years and Hatch for 32.

"He's a special person to me. I want to honor him this way," Hatch said in an interview, his eyes welling up slightly as he listened to a demo tape of jazz and soul singer Tony Middleton perform the song in his signature deep baritone.

"Just honor him, honor him, and every fear will be a thing of the past," Middleton croons in the demo tape, which Hatch played for the Globe.

The gesture — extremely unusual in a Congress that has become increasingly polarized along party lines — reflects the close relationship between the two veteran lawmakers, whose friendship and alliance on health-care issues has baffled and maddened activists in both parties. The 76-year-old Kennedy said the 74-year-old Hatch "is like a brother to me."

And despite the unorthodox notion of a Republican senator's song being played at the Democratic convention, colleagues said they were very moved at Hatch's effort.

"It's a wonderful thing," Senator John F. Kerry, the junior Democratic senator from Massachusetts, said when told of Hatch's composition. "I think it's entirely appropriate" to play it at the convention, Kerry said, because it would send a message of unity.

House majority leader Steny H. Hoyer, D-Md., called the song "a testament to the deep affection that Senator Hatch and Senator Kennedy have for one another. Both share a deep love for this country. I think that's what the song reflects," Hoyer said. He confirmed that the song is under consideration for use at the convention.

Hatch has long maintained that he ran for the Senate "to fight Ted Kennedy" — not just Kennedy's policies, but the man himself. Both men sat on what was then called the Labor and Human Resources Committee, and soon realized that they needed each other to get any bills passed.

What began as a relationship of political expediency developed into a deep friendship, as they counseled each other through personal setbacks and attended the funerals of the other's parents.

After Kennedy's illness was disclosed, Hatch said, he was approached at a fundraiser fund-raiser by several prominent Democrats, whom he would not name.

"One said, 'Why don't you write a song for the convention for Teddy?' So I did," Hatch said. He said he had talked to high-ranking Democrats about having the song performed at the convention with a montage of pictures of the Massachusetts senator, but "I don't know if they'll do it," Hatch said, waving his hand modestly.

Kennedy spokeswoman Melissa Wagoner said the senator, who has no current plans to attend the convention, because he will be undergoing treatment, "is appreciative of the kind words and sentiment from his friend Senator Hatch and looks forward to hearing (the song) when he returns to the Senate in September."

Politicians have crossed party lines before to make dramatic convention appearances or endorsements, but usually with political motives. Former Georgia Democratic Sen. Zell Miller spoke at the Republican National Convention in 2004, and Connecticut Sen. Joseph Lieberman, an Independent who caucuses with the Democrats, has endorsed Arizona Sen. John McCain, the GOP presumptive nominee, for president.

But the idea of a conservative Republican writing a convention song for Kennedy drew plaudits Tuesday on Capitol Hill, where many senators in both parties tell stories about how Kennedy showed them compassion or support during a personal problem.

"I think it's great if they do it," said Sen. George Voinovich, Republican of Ohio. While he and Kennedy have their disagreements, Voinovich said, the Massachusetts senator "speaks from the soul." And even though Republicans want to keep the White House in GOP hands, playing Hatch's song will "show what somebody from the other party — a big conservative — thinks of him," Voinovich said.

The lyrics are a tribute to Kennedy and a call for fortitude as the senator battles a brain tumor. "Through the darkness, we can find a pathway, that will take us halfway to the stars," the song goes. "Shoo the shadows and doubts away, and touch the legacy that is ours, yours and mine."

The "sailing home" line is a reference, Hatch said, to the Bay State Democrat's love of boating off Cape Cod.

The lyrics mean "he's going to make it," Hatch said, and that Kennedy is "headed home" to a Senate eager for his return.

"I pray for him several times a day," Hatch said. "A lot of Republicans are praying for him."