A federal housing regulator announced a plan on Tuesday to provide financial relief to dozens of mortgage servicing firms caught between investors looking to get paid and homeowners who don’t have money because of the coronavirus crisis.

The Federal Housing Finance Agency said the firms had to make just four months of cash payouts to bond investors in mortgages that homeowners have stopped paying.

After the four-month period, Fannie Mae and Freddie Mac — the government mortgage firms regulated by the agency — will assume that obligation, for up to eight more months, if necessary.

The agency and the Treasury Department have faced pressure from mortgage industry lobbyists and legislators on Capitol Hill to come up with a way to make sure mortgage servicing firms do not go bankrupt while providing financial relief to millions of unemployed homeowners. Servicers collect monthly payments from homeowners and use that money to pay property taxes and insurance for the borrower and then send principal and interest payments to the investors in securities that are backed by those mortgages.