Neil Diamond visited Boston in the days following the marathon bombings and left convinced he should do something to help.
"I was moved by the unity and the attitude of the people in Boston," Diamond said. "And that's really all a songwriter needs, is to be inspired. It doesn't happen very often but when it does you have to follow that muse and I did."
The result is "The Freedom Song (They'll Never Take Us Down)," a new patriotically themed song Diamond will release through iTunes and Amazon on July 2. All proceeds from the song will go to benefit the Boston One Fund and The Wounded Warriors Project.
Diamond watched coverage of the April 15 bombings unfold from afar, then visited the city the following Saturday. The Red Sox, the city's Major League Baseball franchise, adopted the 72-year-old singer's hit "Sweet Caroline" as an eighth-inning anthem some time ago and had invited him to perform it live.
The city was still reeling from the Boston Marathon bombings that killed three and injured more than 250 just five days earlier and the ensuing manhunt, but its residents responded to the attacks defiantly.
Diamond returned home and began work on "The Freedom Song." He said in a phone interview it took about six weeks to write and record.
He will perform the song live for the first time July 4 in Washington, D.C., at a Washington Nationals-Milwaukee Brewers baseball game and during PBS' "A Capitol Fourth," broadcast from the west lawn of the U.S. Capitol.
"I didn't know exactly what would happen with this song, but I did know I had to write it," Diamond said. "So I set out on that creative journey of writing something that would lift people up, lift their spirits in the way that mine was lifted when I flew to Boston to sing at the Red Sox game."
Follow AP Music Writer Chris Talbott: http://twitter.com/Chris_Talbott .