A federal judge blocked laws in Santa Monica and San Francisco today that prevent banks from imposing surcharges on the use of their automated teller machines by customers of other banks.

The preliminary injunction by U.S. District Court Judge Vaughn R. Walker that will allow the banks to continue charging their fees will last until he can hold a full trial on the matter. But, in granting the order, Walker ruled that the banks are likely to prevail in their constitutional challenge to the Santa Monica ordinance and a nearly identical law passed by San Francisco voters earlier this month.

Despite the ruling, Bank of America and Wells Fargo will not immediately reopen their 33 ATMs in Santa Monica to all consumers. Several legal details remain to be worked out before the machines can be reopened, a spokesman for Bank of America said.

Last week, in a surprising and controversial move, the banks moved against Santa Monica's law by shutting off ATM service to non-customers. Bank of America threatened a similar move in San Francisco next month, when that city's law was set to take effect.

The case, brought by Bank of America and Wells Fargo, the state's two largest banks, has drawn national attention since Santa Monica and San Francisco became the first two cities in the country to pass laws prohibiting banks from levying surcharges, typically about $1.50 per transaction, when customers of other banks use their machines. The law does not affect the separate charges that banks impose on their own customers for using the machines.

In blocking enforcement of the laws, Walker said the ordinances "cannot under a reasonable stretch" be considered consumer protection measures. Instead, he said, they appear to have restricted consumer choices.