MADRID (Reuters) - People kept their money in Spanish lenders Caixabank (>> CaixaBank) and Banco Sabadell (>> Banco de Sabadell) in the last three months of 2017, despite intense uncertainty over Catalonia's independence bid.

But while deposit levels were stable, income remained under pressure at the two banks, which both moved their headquarters out the northeastern Spanish region in October after regional leaders pursued a secession campaign.

Although the banks said they suffered deposit outflows in the days after the Oct. 1 referendum, which was ruled illegal by Spain's constitutional court, these were quickly reversed.

Sabadell, Spain's fifth-biggest bank, said on Friday its deposits grew 1 percent in the fourth quarter over the previous one, while Caixabank, the country's third-largest, said its had fallen by 0.2 percent.

Caixabank shares were down 4.3 percent at 0817 GMT on the weak quarterly results. The bank's shares had risen by more than 12 percent since the beginning of the year.

Sabadell's (>> Banco de Sabadell) shares fell 3.5 percent. Its stock had gained around 15 percent since January.

Caixabank's net profit more than doubled for the period to 196 million euros ($245 million), but it missed the 352 million euro forecast in a Reuters poll of analysts, falling 70 percent from the third quarter due to a devaluation in Portuguese unit BPI's Angolan business BFA.

Net profit at Sabadell also more than doubled in the fourth quarter to 147.7 million euros, in line with analysts' forecasts, after the sale of some its units.

Spanish banks are struggling to lift earnings from loans, as interest rates hover at historic lows and increasing competition erodes margins. To offset pressure at home, Spanish banks have been expanding abroad in search of higher revenues.

Sabadell's net interest income (NII), profit from loans minus funding costs, was down around 1.7 percent on the previous quarter, while Caixabank's fell 0.4 percent due to BPI.

Caixabank said it expected NII to rise by up to 3 percent in 2018.

Both managed to reduce their non-performing loans at a time when the European Central Bank is working on new guidelines for lenders to reduce bad loans.

Sabadell cut its bad loan ratio to 5.1 percent from 5.4 percent in the previous quarter, while Caixabank ended December with a non-performing loan ratio of 6 percent, compared to 6.4 percent at-end September.

($1 = 0.8603 euros)

(Reporting by Jesús Aguado; Editing by Sonya Dowsett and Alexander Smith)

By Jesús Aguado

Stocks treated in this article : Banco de Sabadell, CaixaBank