PARIS (Reuters) - Aerospace and defence group Thales (>> Thales) has agreed to buy chipmaker Gemalto (>> Gemalto) for 4.8 billion euros (4.23 billion pounds) , trumping an earlier bid by fellow French firm Atos (>> AtoS SE) to expand in the fast-growing digital security market.

The bidding race for Gemalto has come after a difficult year for the Franco-Dutch group in which profit warnings have hurt its share price and overshadowed its attempt to shift from a slowing market for phone SIM cards towards security services such as data encryption and biometric passports.

"This is a terrific project," Thales CEO Patrice Caine told reporters on Sunday. "In digital, Gemalto and Thales are like twins."

Caine said his firm's bid represented a total of 5.6 billion euros , including 800 million of debt in addition to its offer for shares.

This showed its basic 51 euro per share offer for Gemalto was worth 4.8 billion euros in comparison with Atos' 4.3 billion bid based on a 46 euro per share price.

Atos, which saw its offer rejected by Gemalto this week, said in a statement later on Sunday that it would not pursue its bid, although it would be open to talks with Gemalto if Thales' offer fell through.

Thales' all-cash bid has the unanimous backing of the both companies' boards, Thales and Gemalto said in an earlier statement.

The agreement calls for Thales' digital activities to be merged with Gemalto to create a business with 3.5 billion euros in sales which would be a top-three global player in digital security, they said.

"RIGHT DIRECTION"

Christophe Castaner, a junior minister in the French government and head of the party of President Emmanuel Macron, told France 3 television the deal was "in the right direction".

The French state is the largest shareholder in Thales, while state-owned bank Bpifrance is Gemalto's second-biggest shareholder.

Bpifrance said this week it was favourable to consolidation between two French companies in the tech sector.

Thales will finance the offer through its available cash resources and a 4 billion euro fully committed credit arrangement secured for the Gemalto offer, it said.

Thales and Gemalto said their digital security entity would generate pre-tax cost synergies of between 100 million and 150 million euros by 2021, as well as meaningful revenue synergies.

The deal, expected to close in the second half of 2018, would have a positive effect on earnings per share of 15-20 percent, before synergies, from the first year, they said.

Thales did not expect job losses from the takeover and pledged to maintain current job levels at Gemalto's French operations until at least the end of 2019.

However, union officials at Gemalto cautioned that the announcement did not refer to the struggling chip card activity.

Brice Barrier, representative for UNSA, the largest union at Gemalto, said he would call on Gemalto to drop a plan to cut 288 jobs in France.

(Additional reporting and writing by Gus Trompiz; Editing by Gareth Jones and Adrian Croft)

By Cyril Altmeyer

Stocks treated in this article : AtoS SE, Thales, Gemalto