The nation bid a final farewell to Ronald Reagan (search) on Friday in a funeral praising the former president for his lifelong optimism, sense of humor and political accomplishments as dignitaries from around the world and others watched solemnly from packed pews.

With his sunset burial, said President Bush, "a great American story will close."

Bells tolled 40 times to honor America's 40th president, as his casket left the National Cathedral in Washington, D.C., after the funeral service.

Bush eulogized Reagan during the service, saying the nation lost the former president just days ago, but it has missed him for a long time.

Reagan passed through "a thousand crowded places" during his career, Bush said, but there was only one person who could make him lonely just by leaving the room — his wife Nancy.

Bush said Reagan "acted to defend liberty wherever it was threatened," crediting him with leading one of the century's most "decisive decades," noting the fall of Soviet communism.

He was "a man so enchanted by life he can be at peace at life's end," Bush said.

Reagan's former vice president, George H.W. Bush, choked up with tears during his tribute. "As his vice president for eight years I learned more from Ronald Reagan than from anyone I encountered in my years in public life."

During the opening of the service, Rabbi Harold Kushner and Supreme Court Justice Sandra Day O’Connor (search) each read selections, and the Cathedral Choir sang “Jerusalem."

Former British Prime Minister Margaret Thatcher (search), in attendance but not well enough to stand and speak, spoke via prepared videotaped message in which she said: "I have lost a good friend."

Reagan, Thatcher said, "sought to mend America's wounded spirit" and he "embodied a great cause ... the great cause of cheering us all up."

Former Prime Minister of Canada Brian Mulroney (search) spoke after Thatcher. "Ronald Reagan was a president who inspired his nation and transformed the world," he said.

The cathedral's invitation-only crowd of 2,100 included America's four living ex-presidents: Ford, Carter, Clinton and Bush. Democratic presidential contender John Kerry, who canceled political events during the week of mourning, was also present.

The cathedral's great bells rang as Reagan's casket arrived in the rain. A rousing "Battle Hymn of the Republic" followed the eulogies.

Titans of power, past and present, sat shoulder-to-shoulder to pay their respects, including former Soviet leader Mikhail Gorbachev, Thatcher, Britain's Prince Charles, and the first President Bush and his wife, Barbara, one row behind the current President Bush and his wife, Laura.

Reagan's three surviving children, Patti Davis, Ron and Michael, sat alongside Mrs. Reagan at the cathedral. A daughter, Maureen, died from cancer in 2001.

American guns around the world were firing in Reagan's honor — at noontime, 21-gun salutes at every U.S. military base with the artillery and manpower to do it; at dusk, another worldwide round of 50-gun salutes.

As the casket made its way uptown from the Capitol building to the locale of the former president's funeral, supporters and well-wishers lined the wet streets of Washington to say a final goodbye to the man well-known for bringing optimism back to America.

Before the casket was carried down the Capitol steps and loaded into a hearse, Mrs. Reagan stopped in the Capitol Rotunda (search) one last time to say goodbye to her beloved husband.

The former first lady stepped up to the flag-covered casket and knelt beside it while smoothing the flag and murmuring a few last words to the man who was the love of her life.

With misty eyes, Mrs. Reagan kissed the casket and caressed it lovingly a few more times before she was escorted from the rotunda by Army Maj. Gen. Galan Jackman, commander of the Military District of Washington.

But before she was led away, she stopped, turned and touched the casket one last time and spoke just a few more words to the man she was married to for over 50 years.

Joanne Drake, chief of staff of the Reagan office, said Mrs. Reagan was "doing as well as can be expected under the circumstances" and was greatly comforted by the outpouring of support.

Mrs. Reagan's goodbye came after more than 104,000 people wound their way through the Capitol Rotunda to pay their respects and bid farewell to Reagan.

"He did so many great things for our country and I remember a happy and optimistic time for America," Barbara Coward, 37, of Timonium, Md., scribbled in the Capitol Rotunda condolence book. "He made me proud to be an American."

For a detailed schedule of the day's events, click here.

Reagan began talking about his funeral in 1981, the year he became president, family representatives said.

Proud to have put the first woman on the Supreme Court, Reagan years ago asked O'Connor to read at his funeral. At his request, she read from John Winthrop's 1630 sermon that inspired Reagan's description of America as a shining "city upon a hill."

Thatcher and the first President Bush, too, got their speaking invitations long ago.

Mrs. Reagan invited Irish tenor Ronan Tynan (search) to sing Franz Schubert's "Ave Maria." The Reagans specified an interfaith service, inviting participants from Catholic, Jewish, Muslim and other religions.

Reagan's honorary pallbearers were friends from throughout his life: former Reagan aides Michael Deaver and Frederick Ryan; entertainer Merv Griffin; his White House physician John Hutton, and Charles Wick, former Hollywood producer and former head of the U.S. Information Agency.

The casket was actually carried by "body bearers" drawn from each of the military services.

Fox News' Amy C. Sims and The Associated Press contributed to this report.