American Security Corp., which announced Tuesday that it was taking a $37 million charge against earnings to provide for potential loan losses, probably has put most of its problems behind it, banking sources said yesterday.

That American Security had problems in its loan portfolio -- especially in loans to the energy and maritime transportation industries -- had been well known since last spring.

But the magnitude of the special charge announced Tuesday -- apparently under prodding from the Office of the Comptroller of the Currency -- surprised analysts and bankers.

"We expected them to take another hit in the fourth quarter," said one banking industry source. "We didn't expect it to be this big."

American Security, whose principal subsidiary is American Security Bank, already had been salting away large amounts of funds to cover potential loan problems. In the second quarter it added $10.1 million to reserves and in the third quarter it added another $9.3 million. By the standards of American Security, which historically has had one of the soundest portfolios of any regional bank in the country, those loan loss provisions were astounding.

For example, in 1983, not a good year for the banking industry, American Security added $9.6 million to its loan loss reserves. It charged off a net of $6.8 million in loan losses for the entire year.

By contrast, the bank charged off $9 million in the second quarter and $7.4 million in the third quarter.

Banking industry sources said the $37 million loan loss provision for the fourth quarter -- which will result in a large loss for the quarter and at best modest profits for the year -- should cover every potential loss in American Security's loan portfolio, and then some.

One securities analyst who follows American Security closely was a little more cautious. He said he would wait to make a judgment on the bank until examiners wrapped up their examination.

But an official at a competitor of American Security said that the bank would not have made a special announcement of the large addition to its loan loss reserve "without having the benefit of the comptroller's full review of its loan portfolio."

The examiners may still be in the bank, this banker said, but they are "wrapping up the exam."

American Security officials declined to comment on the comptroller's examination until it was completed.

But other American Security competitors suggested the bank's $37 million writeoff probably was bigger than dictated by the problem loans detected by the comptroller's examiners. "If you're going to err, you err on the conservative side," said one banker.

"You don't let bad news dribble out," said another.

Money market investors apparently believed that American Security is solid. More than any other bank in the area, American Security funds itself by selling giant-sized certificates of deposit to professional investors. Funds raised in the money markets are far more volatile than consumer deposits -- such as checking, savings and money market deposit accounts. Consumer deposits for the most part are fully insured by the government. The FDIC insures every depositor up to $100,000.

But American Security had no troubles raising funds yesterday, both American Security and other bank officials said. The bank was able to roll over (refinance) all the big certificates of deposit and commercial paper that matured yesterday. Alicia Castaneda, an American Security vice president, said the bank did not have to pay a premium to investors.

Castaneda said American Security yesterday was liquid -- it had more funds than it needed -- and was a net seller of federal funds to other banks. Federal funds are monies that banks with excess deposits loan overnight to banks that need deposits.

Several American Security competitors said they think the bank company -- which has $3.7 billion in assets -- will show reasonable profits next year. The big loss in the fourth quarter will decimate 1984 earnings.

Last year, American Security had profits of $31.4 million. The year before it earned $28.7 million.

But while there seems to be no doubt that American Security is sound, there also is no doubt that it has tarnished its reputation as an impeccable lender. "That may take longer to recover than its profits," a banker said.