BANGOR, Maine — Penobscot County has signed a contract to pay $825,000 for the former YMCA rather than take the building by eminent domain to ease jail overcrowding.

Purchase of the property, announced Tuesday at the county commissioners’ meeting, will displace CityReach Church and Young’s MMA, a martial arts studio, that both lease space in the Hammond Street building located across Court Street from the Penobscot County Jail.

County officials are scheduled to close on the sale on or before April 15.

County Commission Chairman Peter Baldacci said the leases, which expire April 30, 2018, “would be honored.” No penalty would be imposed if the tenants decided to leave before the leases expire.

The building was owned by the estate of William Buxton, who bought the property in 2013 with plans to open a denturist school. He later abandoned those plans and died in 2016.

For two years, CityReach has rented 3,300 square feet in the building at 127 Hammond Street. That has left about 50,000 square feet empty. Baldacci said Tuesday that renovations in the unoccupied section of the building could begin while the tenants still are there.

The Rev. Bobby Bledsoe, pastor of CityReach, said last month that the church unsuccessfully offered $800,000 to buy the property last year.

Bangor attorney Roger Huber of Bangor, who represents CityReach, said in a telephone interview after Tuesday’s meeting that the church “will work with the county commissioners on how to go forward.”

Baldacci said that the next step will be to organize a group to look at the space needs of the jail, the sheriff’s office and other county departments.

“We definitely feel that this will be the most economical way to deal with the space problems at the jail and all our other needs,” he said. “That’s what we’ll be working on. We just feel it’s a very good investment for Penobscot County and its citizens to acquire this neighboring property for all our future needs.”

Commissioners did not say Tuesday how much they expected renovations — to be funded by issuing bonds — would cost. Baldacci said he hoped the amount would be determined in time for a question asking Penobscot County voters to approve the funding to be on the November ballot.

The deadline to place the question on the ballot is mid-August, according to the Maine secretary of state’s office.

A hearing on March 21 to determine if the county would take the property by eminent domain drew about 50 people, many of them church members opposed to the proposed action. Commissioners took the matter under advisement but the sale negates the need for a vote.

“We are vehemently opposed to the building which we occupy to be taken by eminent domain,” Bledsoe told the commissioners at that hearing. “We love Bangor and we want to see, obviously, the county and the sheriff be successful in everything they do, but there are many other buildings in this city.”

CityReach offers a nine-month faith-based addiction recovery program that also teaches life and job skills, according to Bledsoe.

CityReach had hoped to buy the building as a permanent home for its 3-year-old urban ministry. Bledsoe had hoped to move participants in the recovery program, now living in rented homes, onto the top floor of the former YMCA after renovations had been completed if the church had been successful in acquiring the building.

Sheriff Troy Morton outlined last month some of the challenges of overcrowding at the Penobscot County Jail, including some of the serious medical conditions with which many people come into the facility.

The expansion would allow space for additional services for inmates, ease overcrowding — which is stressful for inmates and staff — and allow for one-on-one consultations, which now often are not private.

“Mental health and substance abuse clearly are at the top of the list of some of the challenges that we have,” Morton said.

The extra space also would help deal with the increasing number of people being held while awaiting trial.

Morton said Tuesday that the jail, authorized to house 157 inmates, had 183 inmates with another 45 boarded out to other facilities. The sheriff has previously said that the cost of boarding inmates was expected to cost between $1 million and $1.5 million by the end of the year. The cost of building a new facility has been estimated to be between $40 million and $60 million.

The original mortgage on the property was for $1.3 million, but it has not been determined how much is still owed to TD Bank. A local company, Bowman Constructors, also had a large lien on the property.

How the $825,000 purchase price will be divided by the bank and lien holder has not been decided, according to Richard Silver, the Bangor attorney representing the construction firm.

“Bowman’s was happy to come to the table to get this building back into commerce,” Silver said Tuesday.

He also said that the long-time family firm hopes to bid on the renovations planned by the county once the request for proposals is issued.

David Hirshon, the Freeport attorney who represents TD Bank, said Tuesday in an email that the mortgage holder had agreed to the “short sale.”

“The bank is owed more by the owner than the sale price,” he said.

Hirshon did not specify how much money the bank is owed.