A federal bankruptcy judge yesterday gave the state of Maryland control over millions of dollars in rental income flowing from more than 20,000 houses managed by an affiliate of Equity Programs Investment Corp. (EPIC), the real estate arm of Community Savings & Loan.

The move completes the freezing of EPIC's assets and opens the way for a likely protracted legal battle over the disposition of funds related to the Falls Church company, which is delinquent or in default on payments on $1.4 million worth of mortgages and mortgage-backed securities.

EPIC filed for bankruptcy protection in Alexandria last week on behalf of 341 of the limited partnerships that bought houses through EPIC as tax-sheltered investments -- just hours before the Maryland Deposit Insurance Fund (MDIF) was appointed conservator for Community and the related EPIC group of companies.

However, the affiliate company, EPIC Realty Services Inc. (ERSI), was not included in either of these actions. Earlier this week, lawyers for Maryland moved to take control of the rental payments ERSI manages, which have been estimated at several million dollars a month.

U.S. Bankruptcy Court Judge Martin V. B. Bostetter yesterday granted the request, ordering that MDIF take control of the savings account where the EPIC rents are deposited, said Norman Oliver, an attorney for the U.S. Trustees Office in Alexandria. The ERSI funds were the last major source of EPIC-related cash outside state control.

Now that all of EPIC's assets are frozen, lawyers for EPIC, its creditors, people who invested in the partnerships and the companies that insured EPIC's mortgages have begun taking positions in the complicated legal battle that will now ensue over how to restructure the company so that it can meet its debts.

The question crucial to these proceedings is whether the EPIC properties are worth more than the mortgages outstanding on them. If they are, the holders of the mortgages could foreclose on the homes and recoup their investments with minimal losses.

Even if, as some preliminary reports indicate, the properties are not that valuable, a restructuring of EPIC might be possible that would stretch payments out over a longer period of time. By stretching payments out, the properties could appreciate and the company could eventually meet its debts, lawyers said yesterday.

But whether such an agreement could be reached and accepted by Maryland officials and the bankruptcy judge depends on bringing together a number of disparate parties, which will likely hold competing interests.

Institutions that hold EPIC's mortgages and mortgage-backed securities are reportedly anxious to foreclose on the homes as quickly as possible, cut their losses, and have the mortgage insurance companies foot most of the bill for the EPIC collapse.

A lawyer for the Federal National Mortgage Association declined yesterday to speculate on the possible outcome of the bankruptcy proceedings. But in an interview last week, the organization's president, Mark J. Riedy, indicated that he would have preferred a quick foreclosure, an option now indefinitely delayed by the bankruptcy proceedings.

On the other hand, the companies that insured EPIC's mortgages would like to delay such foreclosures as long as they can to delay potential claims that have been estimated at up to $400 million, lawyers involved in the bankruptcy case said.

Executives for the principal insuring companies involved could not be reached for comment yesterday. However, sources said they have put together a plan for a restructuring of EPIC. Under the plan, their companies would contribute some cash to enable the partnerships to meet their interest payments. One of the companies, Ticor Mortgage Insurance Co., has scheduled a meeting for later this week to discuss the situation, said one source, who asked not to be identified.

"We understand that they are getting together and have a proposal to discuss," said Daniel M. Lewis, an attorney representing MDIF. Lewis said, however, that he did not know the specifics of the plan.

He said that the Maryland lawyers have begun meeting with interested parties and investigating EPIC's finances, but the state does not yet have a clear idea as to how it will proceed in the bankruptcy proceedings. He indicated, though, that the state favors an orderly disposition of EPIC's assets to maximize their value -- and hence the money available to depositors in Community, which advanced significant funds to the real estate investment company.