The crosstown battle between two Baltimore banking giants came to an end yesterday when First Maryland Bancorp withdrew its offer to acquire rival Baltimore Bancorp for $17 per share.

After months of rebuff, First Maryland Chairman Jeremiah E. Casey said he was withdrawing his unsolicited $217 million bid, citing economic conditions that have hammered Baltimore Bancorp's stock price and forced a number of borrowers to fall behind on their loans.

The bank, a wholly owned subsidiary of Allied Irish Banks PLC of Dublin, left open the possibility of future merger talks, but only if Baltimore Bancorp expressed interest.

First Maryland made its bid in April at the height of the merger mania that was sweeping the region's banking industry, creating banking giants like Signet Banking Corp., Crestar Financial Corp., and more recently, MNC Financial Inc. and C&S/Sovran.

But the offer, which would have created a Baltimore banking powerhouse by merging the state's second- and fourth-largest institutions, was met with strong resistance from Baltimore Bancorp's chairman, Harry L. Robinson. It touched off a storm of controversy in the Baltimore business community, which had never seen a hostile takeover between local firms.

Yesterday's action drew a sigh of relief from Baltimore Bancorp President John C. Haigh, who insisted that a formal bid had never actually been received. "Now we can get back to the basics of running the bank and planning the future of Baltimore Bancorp for the benefit of our customers and shareholders, without outside pressure," Haigh said.

But some Baltimore Bancorp shareholders might take a different view. Since Jan. 1, the value of Baltimore Bancorp stock has plummeted 48 percent, to close at $5.12 1/2 a share yesterday. When First Maryland made its overture, the stock was trading at $10.25. First Maryland Chairman Casey said then that the $217 million cash bid represented about 13 times Baltimore Bancorp's 1989 earnings of $1.34 a share.

"In retrospect, there might be some shareholders who are pretty upset that Robinson turned them down," said analyst David Penn, who follows the two companies for Legg Mason and Co., a Baltimore brokerage firm. "If I were Baltimore Bancorp, I would have come back with a press release today saying we are willing to talk at $17."

But Robinson has never swayed from his conviction that the Bank of Baltimore, Baltimore Bancorp's main subsidiary, should remain "an independent institution."

Before a crowd of angry shareholders last spring, many of whom wanted to enter into merger negotiations, Robinson swore that he would never sell the bank company "to foreigners" and he promised that Baltimore Bancorp would remain "a local company."

His comments sparked criticism from shareholders who said Robinson was acting in self-interest. The meeting prompted the company's largest shareholder, T. Rowe Price Associates Inc., a Baltimore mutual fund company, to inform the Securities and Exchange Commission that it might work with other shareholders to force bank managers to accept the offer.

Spokeswoman Carol E. Dunsworth said First Maryland still is interested in a merger, but she said Baltimore Bancorp would have to initiate talks.

Dunsworth said First Maryland did not withdraw its offer sooner, because "we were still very interested. It only recently became clear that the economic environment was deteriorating to the point where a $17 per share offer was no longer appropriate."