Two Spanish investment firms with a majority stake in French property company Gecina have filed for bankruptcy on 1.6 billion euros ($2.1 billion) of debt, a source with knowledge of the matter said on Wednesday.

The bankruptcy proceedings, amongst the biggest in Spanish corporate history, follow failure by the two firms, Alteco and MAG Import, to refinance a syndicated loan. They hold have a combined 31 percent stake in Gecina, France's largest property company.

Spain's Banco Popular , Bankia , NCG Banco, France's Natixis and the Royal Bank of Scotland are the banks with the most exposure to the syndicate, El Pais newspaper said.

The impact on the Spanish banks may be limited considering that lenders have already written off hundreds of millions of euros in losses on soured real estate investments under government demands.

"On one hand the loan would be practially covered with its position in Gecina ... and we understand this will be one of the credits included in the stress test to the sector," Banco Sabadell said in a note to clients.

A banking source said Bankia had a 234 million euro exposure to the two companies. Bankia declined to comment. Popular declined to comment. El Pais put Popular's exposure at 264 million euros.

Alteco and MAG Import are owned by Spain's one-time real estate magnates Joaquin Rivero and the Soler family.

Shares in Gecina were down 1.2 percent at 79.7 euros in morning trade. ($1 = 0.7731 euros)

(Reporting By Carlos Ruano and Tracy Rucinski; Additional reporting by Sonya Dowsett; editing by Anna Willard)