Washington (CNN) President Barack Obama addressed the National Prayer Breakfast on Thursday, speaking about the need to overcome fear through faith, just one day after making a historic visit to a Baltimore mosque where he delivered a message of religious inclusivity.

"Fear can lead us to lash out against those who are different or lead us to try to get some sinister 'other' under control," said Obama, making a veiled reference to divisive rhetoric on the presidential campaign trail.

"Alternatively, fear can lead us to succumb to despair or paralysis or cynicism," he said. "Fear can feed our most selfish impulses and erode the bonds of community."

However, he said, "Faith is the great cure for fear."

These fears, Obama said with a hint of regret, include the fear of children growing up "too fast."

"They're leaving!" he said, smiling. The Obamas' oldest daughter, Malia, is heading off to college in the fall.

Obama also praised faith groups for their work on a variety of issues, from combating trafficking to welcoming and supporting refugees, and celebrated the return of pastor Saeed Abedini, who was recently released from an Iranian prison.

"Last year we prayed that he might be freed and this year we give thanks that he is home safe," said Obama.

The prayer breakfast, co-chaired by members of Congress, provides an opportunity for people from across the political spectrum to come together and speak about how faith has shaped their lives.

House Speaker Paul Ryan spoke about "a growing impatience with prayer in our culture."

"You see it in the papers or on Twitter," said Ryan. "When people say they're praying for someone or something, the attitude in some quarters seems to be, 'Don't just pray; do something about it.' "

"But the thing is, when you are praying, you are doing something about it," he said.

House Democratic Leader Nancy Pelosi read from the Gospel of John, saying the Golden Rule expressed there holds true across religions.

The politicians were joined by notable figures from outside the beltway, including University of Alabama running back Derrick Henry -- who delivered a closing prayer -- and Italian classical singer Andrea Bocelli, who sang.

Obama striking the Heisman pose with the most recent Heisman winner Derrick Henry

The breakfast also featured a keynote address by producer Mark Burnett and actress Roma Downey -- the husband and wife team behind the popular 2013 History Channel miniseries "The Bible" -- which was once the subject of criticism because the actor who played Satan was said to resemble Obama.

Ben Carson, the GOP presidential candidate who rose to prominence after giving an impassioned speech at the 2013 National Prayer Breakfast, attended the event but did not address the crowd.

The speech was "an opportunity for the President to discuss his own faith journey, the healing work of religious communities around the world, and the importance of joining hands to work together," a senior administration official told CNN Wednesday.

Obama has spoken at the National Prayer Breakfast every year since he took office in 2009.

Last year, the President came under fire for speaking about the Crusades as an example of violence committed in the name of Christ, making the case that religious violence isn't limited to any one religion or time.

"And lest we get on our high horse and think this is unique to some other place, remember that during the Crusades and the Inquisition, people committed terrible deeds in the name of Christ," he had said.