That ATM in the dark corner of the bar could be on its way out.

By October, ATM owners in the United States have to replace or upgrade their machines to accept chip cards or face liability for certain types of fraud. But the upgrade and related ongoing maintenance are so expensive that cash-machine operators like Abe Ayesh, who helps manage about 8,000 ATMs mostly on the East Coast, plans to shut down some of them.

"The machines that used to do barely enough to support, do I want to go spend $3,000 right now for a new machine that's going to take me three to four years to get my money?" asked Ayesh, chief operating officer of FAM ATM. "It's not worth it."

Upgrading his existing fleet will cost $4 million — his company's entire annual earnings without charges like depreciation and taxes, he said. In general, costs to upgrade an ATM's hardware and software range from $300 to $3,000. Some 410,000 ATMs have to be upgraded, according to researcher Aite Group. Owners have to clean the new chip-card reader at least once every couple of weeks — and that cleaning kit costs another $1.50 a pop.

Up to 10 percent of so-called retail ATMs — those not owned by banks — might be thrown out instead of souped up or replaced because of the move to chip cards, James Phillips, a vice president at retail ATM maker Triton Systems of Delaware, said. Other old machines might stay operational but not be upgraded — and eventually simply stop working, he said.

On Oct. 1, ATMs that don't move to accept the chip technology — called, in industry parlance, EMV — will become liable for any counterfeit fraud that's perpetrated on the machines using MasterCards. In October 2017, Visa Inc. will start enforcing a similar rule, shifting liability for the fraud to the ATM owner.

About 20 percent of U.S. ATMs have been adapted to accept the chip cards, according to MasterCard estimates. By Oct. 1, that will creep up to 35 percent, said Bruce Owens, a senior vice president at MasterCard.