Europe is creating a train giant to fend off Chinese competition.

French high-speed train manufacturer Alstom (ALSMY) is merging with the transportation unit of Germany's Siemens (SIEGY), the companies said in a statement late Tuesday.

Siemens has been pursuing partners for its railway business, reportedly holding talks with Swiss manufacturer Stadler Rail and Canadian rival Bombardier (BDRAF).

The deal was billed as "a merger of equals," but Siemens will have majority control of the new company -- owning 50% plus a few shares.

Other terms are designed to defuse a potential backlash in France, where there is likely to be opposition to one of the country's industrial jewels coming under German control.

The combined firm will be headquartered in Paris and led by Alstom CEO Henri Poupart-Lafarge.

Siemens has agreed not to increase its stake in Alstom beyond 50.5% for four years, and it has provided "certain governance and organizational and employment protections."

Shares in Alstom gained 6% on Wednesday, while Siemens added 2%.

The deal aims to counter China's growing clout in global rail markets. Beijing stepped up its efforts in 2015 by merging two big companies into state-backed giant CRRC, which describes itself as "the world's largest supplier of rail transit equipment."

"The global marketplace has changed significantly over the last few years. A dominant player in Asia has changed global market dynamics," said Joe Kaeser, CEO of Siemens.

Related: The German economy has a weak link: Infrastructure

CRRC has won major contracts to supply metro cars to Boston, Chicago, Melbourne and other cities. It has set up joint ventures in India, Malaysia and Russia.

"With CRRC seeking to expand into overseas markets, the pressure has been on to drive European consolidation and Siemens has been trying for a long time to find the right solution for its rail activities," Barclays analyst James Stettler said in a note to clients.

The combined company will still be much smaller than CRRC, with combined sales that are less than half of the $33 billion reported by the Chinese giant in 2016.

Related: Siemens dumps Russian partner over Crimea

French President Emmanuel Macron has been pushing for closer economic cooperation in Europe, including the creation of regional "giants" capable of competing with Chinese and American rivals.

Alstom sold its energy business to General Electric (GE) in a politically charged deal in 2014.