President Barack Obama talks with Rev. Luis Leon as he leaves St. John's Episcopal Church after attending services in Washington in September of 2010. (Charles Dharapak/AP)

The Rev. Luis Leon doesn’t mind preaching in relief.

Leon, who feels a little as if he has been summoned from God’s bullpen to offer the closing benediction at President Obama’s inauguration next week, said he’s honored, thrilled and just a little nervous.

“Relievers are important, as we learn in baseball,” Leon said Wednesday in an interview at St. John’s Church across the street from the White House. “It’s a great honor. It’s been a joy to be asked.”

Leon, who has served as rector of the historic church since 1995, also knows something about the game of politics. The Episcopal church — whose worshipers have included every president since James Madison — ministers to Republicans and Democrats, Washington big shots and homeless folks.

In 2005, Leon offered the invocation at the second inauguration of President George W. Bush. Bush worshiped at the church once or twice a month. Obama has also attended Sunday services on occasion.

Leon was picked this week to replace the Rev. Louie Giglio, a conservative evangelical minister who withdrew two days after his selection was announced because of controversy over anti-gay remarks he made more than a decade ago. The Presidential Inaugural Committee, which chose Giglio because of his campaign against human trafficking, said organizers were not aware of the 1990s sermons and wanted a religious figure whose views reflected the administration’s.

Shaun Casey, a Wesley Theological Seminary ethics professor, said the episode demonstrates the political challenge of finding a religious speaker who will be acceptable to everyone in an increasingly pluralistic society. Plus, almost every minister has a sermon or two in which he or she said something provocative, Casey said.

“It’s hard to pick anyone without that political baggage,” Casey said. The controversy over Giglio also shows the distance the country has traveled on gay rights just since 2009, when Obama’s selection of the Rev. Rick Warren to give the invocation offended gay rights advocates. Warren spoke anyway.

“In 2009, they were willing to do that. In 2013, they weren’t,” Casey said.

This time, President Obama chose Myrlie Evers-Williams, the widow of slain civil rights activist Medgar Evers, to give the invocation at the president’s swearing-in ceremony. It is thought to be the first time a woman, and a lay person instead of a clergy member, will do so. Casey called her selection a “stroke of genius.”

Giglio’s replacement is a safe and proven choice.

“He is a superb preacher. He’s very committed to social justice. And he is also a very thoughtful, spiritual leader,” the Rev. Samuel T. LLoyd III, former dean of Washington National Cathedral, said Thursday. “He has an amazing personal story.”

Leon came to the United States from Cuba in 1961 at age 12 with just $3 in his pocket after his parents sent him out of the country because they feared for the future under dictator Fidel Castro.

Leon spent three years in Miami and then went off to boarding school in Rome, Ga., on a church scholarship. He attended the University of the South and the Virginia Theological Seminary before entering the priesthood. He earned a reputation for building an urban congregation while serving as rector at Trinity Church in Wilmington, Del., and St. Paul’s Church in Paterson, N.J., before coming to St. John’s in the nation’s capital.

Known as “the church of the presidents,” St. John’s ministers to members of Congress and homeless people who wander Lafayette Square. Tourists drop in, too, sometimes by the busload. Among the church’s parishioners are defense secretary nominee and former senator Chuck Hagel (R-Neb.), Sen. Mary Landrieu (D-La.), FBI Director Robert S. Mueller III and former energy secretary Samuel Bodman.

“It’s pretty much the unstated way of being here is that you have to check your partisan politics at the front door of the church,” Leon, 63, said. “That’s what I inherited when I came here. . . . I don’t know when that started, but folks respect that here.”

The Rev. Canon Jan Naylor Cope, who is vicar at the cathedral, met Leon when she led the search committee that brought him to St. John’s. Cope said Leon impressed her as someone who has lived his life in the spirit of the words chiseled into stone on a building at Virginia Theological Seminary: “Seek the truth, come whence it may, cost what it will.”

“That really is Luis,” Cope said. “Very early in his mission, he was willing to stand up and speak at St. John’s about things that weren’t popular.” Those things have meant discussing HIV/AIDS, acceptance of homosexuality and gay marriage, and pushing for affordable housing and other forms of social justice.

“What he’s done is try to articulate the truth of the Christian faith in a very thoughtful way that’s not partisan,” said Lloyd, who is now priest-in-charge at Trinity Church in Boston. “He’s anything but somebody who’s offering pabulum.”

Leon will have about three minutes to deliver the blessing that brings the ceremony to a close. He’s not sure yet what he’ll say, but he has an idea of a theme, and an interest in sounding the right ecumenical notes.

“I always think of God’s blessing as calling forth the best in us,” he said.

Beyonce will take it from there, with a rendition of the national anthem.

Michelle Boorstein contributed to this report.