After months of silence, the polygamous Fundamentalist Church of Jesus Christ of Latter-Day Saints on Wednesday reached an agreement to keep its meetinghouse.

The sect risked losing the Leroy S. Johnson Meetinghouse in Colorado City, Ariz., in a lawsuit over how the building was being used. Sheriff’s deputies — some dressed in camouflage tactical gear — and a locksmith arrived at the meetinghouse Wednesday. A video posted to Facebook shows the deputies and locksmith outside the meetinghouse as FLDS members stand across the street asking questions.

“They won’t take my faith,” teary-eyed FLDS member Lori Barlow told KUTV as she watched the deputies and the locksmith.

In a brief telephone conversation Wednesday afternoon, Jeff Barlow, the executive director of the United Effort Plan (UEP), the land trust that owns the meetinghouse, said the FLDS hadn’t responded to the legal action filed to take possession of the meetinghouse. A Monday hearing, Barlow said, led to the UEP getting title.

Then, on Wednesday, the deputies and the locksmith stood outside the meetinghouse for 45 minutes to give the FLDS one more opportunity to make contact, Barlow said.

“Sure enough, someone representing the people in the building reached out and talked to us,” Barlow said.

A short time later, an FLDS leader — Barlow declined to say who. — arrived, and an agreement was reached.

Barlow said the FLDS will keep the meetinghouse in exchange for assurances that the building is being used for religious purposes and will be well-maintained. FLDS members allowed Barlow to walk through the structure.

For almost three decades, the FLDS have used the meetinghouse as their spiritual and logistical headquarters. Besides being used for weekly services, former FLDS members have told how church leaders would keep offices there and how the building had a control room to monitor video cameras mounted throughout Colorado City and adjoining Hildale, Utah.

In 2006, FBI agents arrived at the meetinghouse during a Saturday work project meeting to serve subpoenas on men wanted to testify before a grand jury. One of the men to be served that day, Lyle Jeffs, brother of FLDS President Warren Jeffs, escaped aboard an ATV hidden in a basement room.

Since 2005, Hildale and Colorado City have been involved in disputes with the land trust that owned most of the properties in the towns and was once controlled by Warren Jeffs, called the United Effort Plan (UEP). A Utah judge ordered the UEP to be reorganized, and its current board does not include any Jeffs followers. The board has been taking control of homes, businesses and other properties where FLDS members have refused to sign occupancy agreements or have let the property taxes fall behind.

Trent Nelson | The Salt Lake Tribune Girls riding a float representing Snow Canyon High School launch a water fight with boys passing by at the end of the Colorado City and Hildale Fourth of July Parade in Hildale, UT, and Colorado City, AZ, Saturday July 2, 2016. At rear behind a large wall is the Leroy S. Johnson meetinghouse, used by the FLDS Church.

On March 9, the UEP filed a lawsuit in an Arizona court to evict the FLDS from the meetinghouse. The lawsuit said the FLDS merely have a special-use deed to control the property. That deed was issued in 1988 and required the FLDS to operate the building in accordance with the tenets the church had at that time. In its lawsuit, the UEP argued that the FLDS had stopped using the meetinghouse as it was intended; the community was supposed to have access to the building, but access was restricted to permitted FLDS followers, even during funerals.

Barlow on Wednesday night acknowledged that the FLDS members still aren’t living up to the terms of the deed, but he called the agreement good progress. The UEP trustees, Barlow said, didn’t want the FLDS to lose their place of worship.

“It was better than the alternative,” Barlow said.

Warren Jeffs is serving a sentence in Texas of life plus 20 years in prison for sexually abusing two girls he married as spiritual wives.