SALT LAKE CITY — With endurance as the theme, three dozen people gathered Sunday for a lively celebration of the 130-year history of Utah's first black-founded church.

In a special sermon, Pastor Daniel Stalling told members of the Trinity African Methodist Episcopal Church in Salt Lake City to hold to their beliefs as they confront racism, difficult moments and other tests.

"God works through trials. If there's no trial, no testing of your faith, you don't know what you have," said Rev. Stalling, one of several interim pastors at the church. "You have to go through something to understand who you are."

Rev. Stalling joined others, including a pianist and two singers on loan from Brigham Young University, to lead churchgoers through several upbeat hymns. Many got on their feet and clapped, and some recorded the singing and dancing on their phones.

"It's about community. You've got to carry the church with you," Rev. Stalling said as a few people nodded in agreement and others replied aloud, "yes." Some at the celebration had gray hair and arrived with the help of a walker or the steady arm of a companion. Others bounced toddlers on their hips and gave them cookies and juice.

Trinity, Utah's first African American-founded church, formed in the 1880's with just a few families who raised the money to start a foundation for the building, said Lucinda Sampson, a member of the congregation.

"The church is slowly moving on," she said as sunlight streamed through stained glass windows inside the historic A.M.E. Church building, which was erected in 1907.

An exact founding date isn't known, but the congregation is believed to be about 130 years old, said Rev. Nurjhan Blanch Govan, who recently retired but remains at the church as an interim pastor. No matter its exact start date, the Salt Lake church was established before Utah was admitted to the Union in 1896 as the 45th state —a crew broke ground on a previous A.M.E. church building in 1891.

The congregation has faced its own hurdles, Rev. Govan said. It has fewer congregants than in the past as older members have passed away and newer ones have joined other churches.

"This is the oldest ethnic minority church in Utah. As such, I think it has importance," Rev. Govan said after the service. "I think we should not become extinct."

Rev. Govan said the church is seeking to raise money to hire its own full-time musician and is hoping to secure financial support from Salt Lake City and various foundations to help ensure it remains in place for generations to come.

Hitting the estimated 130-year threshold is a blessing, the Rev. Daryell Jackson, pastor at Ogden's Embry Chapel A.M.E. church, said during the service. The Rev. Jackson said racial strain, which his congregation still sometimes faces today, led the church's founder, Bishop Richard Allen, to start the first A.M.E. church in Philadelphia in 1794.

"He said, 'I have a God of not one certain race, but of all races,'" Rev. Jackson said. Later this year, Jackson will be appointed to succeed the semi-retired Rev. Govan, she told the congregation.

During the roughly two-hour celebration, the reverends touched on racism broadly but did not delve into specifics. The church in the past has spoken against police brutality and against deaths of black men at the hands of officers.

A member of its own congregation, Allen Nelson, died in 2012 after his family said police deployed a Taser on him while arresting him, causing him to have a heart attack. Salt Lake police disputed the stun gun was used.

"He was one of our guys," Govan said Sunday. She said her congregation has been dismayed at the number of African-American men who have died in similar situations in Utah and in other states.

Richetta Glover, who is from Stone Mountain, Georgia, but lives part-time in Utah for her job as a contractor with a bank, said after the celebration that one piece of Stalling's message in particular resonated with her: The church has remained for more than a century because other people prayed for it.

"It's a very small congregation," Glover said, "but hopefully, to grow."