WASHINGTON — A Beatle met the president when Sir Paul McCartney performed at the East Room of the White House on Wednesday night.
Accepting the Library of Congress Gershwin Prize for Popular Song, Mr. McCartney used the occasion to applaud President Obama. “Getting this prize would be good enough,” Mr. McCartney said. “But getting it from this president ...” He smiled.
He added that despite “difficult times” for the president, “you have billions of us who are rooting for you.” Then, with the first lady in the front row, Mr. McCartney sang “a song I have been itching to do at the White House,” he said. It was “Michelle.”
A few minutes after the concert, Mr. McCartney returned to the microphone, thanking the Library of Congress and adding, “After the last eight years, it’s great to have a president who knows what a library is.”
It was not a lighthearted party. Mr. McCartney sang reflective songs like “Eleanor Rigby” and “Let It Be.” The president praised Mr. McCartney but also brought up the catastrophic Gulf Coast oil spill. Mr. Obama spoke about “part of the country this is so rich in musical heritage” and said he was committed to “see to it that their lives and their communities are made whole again.”
Mr. McCartney heard praise for his songs — and some performances — from President Obama and from multiple generations of pop, jazz, country and classical musicians. He opened the concert playing the same violin-shaped bass he used with the Beatles in 1964 on “The Ed Sullivan Show.”
Stevie Wonder, who won the Gershwin Award last year, steamed through “We Can Work It Out” — insistently repeating the title before a crowd of politicians — and he later joined Mr. McCartney for an earnest duet on “Ebony and Ivory.”
The lineup also included Herbie Hancock, Elvis Costello, the Jonas Brothers, Emmylou Harris, Faith Hill, Corinne Bailey Rae, Dave Grohl of the Foo Fighters, and Jack White of the White Stripes, backed by Mr. McCartney’s touring band. The show is to be broadcast as a PBS special on July 28.
Mr. McCartney, who turns 68 on June 18, is the third winner of the Gershwin Prize, the highest American award for popular song. He is the first recipient who is not an American.
“We stole you,” Mr. Obama said.
So far, the Gershwin Prize has been awarded to skillful melodists who forged their reputations in the 1960s: Paul Simon in 2007 and Mr. Wonder in 2009, the first time the award was presented at the White House.
Lang Lang, the Chinese classical pianist, performed one of Mr. McCartney’s classical compositions, “Celebration.” The rest of the concert was drawn from the Beatles and Mr. McCartney’s later career.
Mr. McCartney heard some fond imitations of himself. Mr. Grohl in “Band on the Run” matched Wings’s version scream for scream, and Mr. White carefully knocked on his guitar like the original “Mother Nature’s Son.” But there were also a few transformations, as when Mr. Hancock and Ms. Rae played “Blackbird” as a supple jazz ballad.
Mr. Costello sang “Penny Lane” after saying that Penny Lane was half a mile from where his mother grew up, and that when the song came on the radio, “Myself, my mum, my dad and the cat all stood up and took notice.” In a red dress uniform, Master Sgt. Matthew Harding, a member of the United States Marine Band, played the piccolo-trumpet solo.
Some songs were slyly chosen. The Jonas Brothers, a pop band that regularly faces high-pitched teenage squeals reminiscent of Beatlemania, sang “Drive My Car,” which insists, “Yes, I’m gonna be a star.”
Jerry Seinfeld tried music criticism in his monologue, analyzing Mr. McCartney’s lyrics and asking just what he meant when he sang, “She was just 17/You know what I mean.”
Ms. Harris sang an aching, acoustic-guitar version of “For No One,” a song she recorded for her major-label debut album in 1975. “It’s so incredibly sad,” she said before the concert. Mr. McCartney, she added, “writes lyrics that can stand on their own, but they certainly soar when paired with the melody.”
In a news conference at the Library of Congress on Monday, Mr. McCartney had called the process of songwriting a mystery. “You start with a black hole and if you’re lucky, a couple hours later there’ll be a song waiting there. That mystery, that magic is still the same for me.”
Mr. McCartney ended the concert with a song that’s ideal for an all-star singalong, “Hey Jude,” with the first family joining in.
A version of this article appeared in print on June 3, 2010, on page A25 of the New York edition.