Robert Covelle, the embattled executive director of the Medford Housing Authority, is resigning, nearly a year after state officials initially visited the Riverside Avenue agency headquarters to investigate allegations of widespread favoritism in hiring and contracting under his leadership.

Covelle, 59, will receive severance equal to three months’ pay, about $31,500, under an agreement that also prevents him from contending later that he was wrongly terminated, even though his $126,000-a-year contract is being ended 25 months early.

The agreement, which still requires a final signoff by the authority’s board of directors, was reached almost three weeks after Governor Deval Patrick demanded Covelle’s resignation amid reports that he had demoted one employee to promote a close friend and that he gave a no-bid interior decorating contract to his son’s girlfriend.

Initially, Covelle insisted he would not quit, prompting Mayor Michael McGlynn, the housing authority board, and the Medford City Council to call for his resignation.

“It’s time for the Medford Housing Authority to move forward,’’ said Sylviajean Baumeister, a board member who turned against Covelle after discovering that he had suspended a staff member who had complained about favoritism to the board. “We’ve all learned a lesson, that people don’t always tell you everything. We were left in the dark.’’

During negotiations, Baumeister said, Covelle had argued that he should receive 25 months’ pay, more than $250,000, in exchange for resigning. But, she said, “some of us didn’t want to give him anything.’’

Covelle, who became Medford’s housing chief in 2009 with the backing of McGlynn and Covelle’s brother in law, the late Middlesex County Sheriff James DiPaola, declined to comment. But his lawyer said that Covelle accepted the three-month severance package to end the controversy.

“Like the housing authority, he’s desirous of putting this whole episode behind him and moving on with his career,’’ said the lawyer, Thomas Drechsler. “He’s satisfied with the resolution. I can’t say anything more because I don’t have a signed agreement yet.’’

Covelle’s resignation marks the second time in the last seven months that a local housing chief has stepped down under pressure from Governor Patrick. Chelsea housing director Michael E. McLaughlin resigned hours after Patrick called for his resignation following a Globe report that McLaughlin had deliberately concealed his inflated $360,000 salary from state officials.

Patrick does not directly control the state’s 242 local housing authorities, appointing only one of five board members that hire and fire directors. However, the state provides more than $150 million a year in funding for most of the agencies, giving Patrick considerable leverage. In the wake of the McLaughlin controversy, Patrick created a study commission to look at ways to increase the public accountability of housing authorities.

“If [Covelle] worked for the governor, he would have been fired already,’’ said Brendan Ryan, Patrick’s communications director. “Since he doesn’t, the board had to negotiate with him. While it’s in the best interest of the tenants and taxpayers that the housing authority gets new leadership, it is certainly frustrating that it took a severance agreement to make it happen.’’

Ryan said the governor’s new appointee to the board, Sean Caron, was instrumental in persuading other board members to reach an agreement with Covelle, who had previously agreed only to take a two-week unpaid leave as punishment for his management mistakes. Caron “worked hard to make it happen,’’ Ryan said.

But some of Covelle’s critics said that while they were glad he is gone, they were disappointed that the board agreed to pay him anything.

“I don’t think he should get any money at all,’’ said Medford city councilor Robert Penta, the driving force behind the council’s 7-0 vote Tuesday demanding Covelle’s resignation. “Maybe it’s good to get rid of him, but it’s leaving an aftertaste.’’

Covelle’s ouster ends a turbulent year at the authority, which oversees about 1,600 units of housing for people with low income. During that time, the agency has been raided twice by state officials, and Attorney General Martha Coakley launched a criminal investigation last fall, convening a grand jury to consider whether to bring charges.

In addition, federal inspectors from the US Department of Housing and Urban Development concluded in March that the Medford Housing Authority paid $1.3 million to 21 contractors without following federal contracting rules.

Among the questionable expenditures HUD cited, the authority hired the girlfriend of Covelle’s son to do more than $4,000 worth of seasonal decorations in the office. He also hired his close friend and bocce teammate Santo Pirro to a $53,000-a-year job, demoting a staff member to create the opening, employees say.

Employees also told the Globe that Covelle punished two female employees who complained separately in writing to the housing authority board about Covelle’s alleged attempts to get jobs and subsidized housing for insiders. Each was suspended from work for allegedly being rude or for showing anger, according to records and interviews.

Currently, the Medford police and Coakley’s office are investigating another allegation against authority officials, involving the disappearance of thousands of dollars worth of salvaged copper from a housing authority demolition site.

In that case, John Lonergan, Covelle’s director of operations, admitted in an interview that he sold the copper and put the proceeds in a desk drawer where he said the $1,300 remained forgotten for more than a year.

Lonergan said he had Covelle’s approval to sell the copper and use the money to throw a party for maintenance workers, though Covelle disputed that. The party was never held.

In addition, Covelle is facing criticism for allowing the hiring of a maintenance worker who had previously been convicted of a sex crime. The employee, a close friend of Lonergan, was hired without the usual Criminal Offender Record Information check that would have shown that he had pleaded guilty in 2003 to a felony charge of having sex with an inmate while working as a correctional officer at the Middlesex County jail. The employee has not returned to work since the Globe disclosed his criminal record May 2.

Mayor McGlynn was a close friend of DiPaola, the late Middlesex sheriff, whose widow works as one of McGlynn’s assistants. Covelle is married to DiPaola’s sister.

McGlynn declined comment Wednesday, saying he wanted to wait for the agreement to be finalized.