FRANKFURT/BEIJING (Reuters) - China's Beijing Automotive Group Co Ltd (BAIC) has bought a 5% stake in Daimler DAIGn.DE, cementing their long-standing alliance after China's Geely emerged as a potential rival by also taking a stake in the German automaker.

Slideshow ( 2 images )

BAIC has been Daimler’s main partner in China for years, operating Mercedes-Benz factories in Beijing through Beijing Benz Automotive.

But last year Li Shufu, the chairman of Zhejiang Geely Holding, bought a 9.69% stake in the German company with the aim of forging an alliance to develop electric and self-driving cars.

“This step reinforces our alignment with, and strong support for, Daimler’s management and strategy,” BAIC chairman Heyi Xu said on Tuesday.

Reuters reported in May that BAIC was seeking to buy a stake of up to 5% in Daimler as a way to secure its investment in Beijing Benz Automotive.

Daimler, which since 2013 has held a stake in BAIC’s Hong Kong-listed unit, said it welcomed BAIC’s investment.

“The purchase of Daimler shares by BAIC will strengthen the cooperation between BAIC and Daimler,” said Jefferies analyst Patrick Yuan.

“From this point of view, the possibility of Daimler increasing its stake in the Beijing Mercedes-Benz joint venture will be greatly reduced, which will benefit the shareholders of BAIC’s listed companies.”

Shares in Daimler rose by more than 2.5%, while BAIC's listed subsidiaries, BAIC Motor Corp 1958.HK and BAIC BluePark New Energy Technology 600733.SS, climbed by more than 3% and 5% respectively after the news.

The high cost of electric car batteries has made it hard for automakers to build affordable zero-emissions vehicles, leading several of them to strike alliances with Chinese partners.

Stuttgart-based Daimler in March agreed to build the next generation of Smart-branded city cars together with Geely, which is based in Hangzhou.

Daimler has reassured BAIC that any new industrial alliances involving Mercedes and a Chinese partner would only happen after a consensus is found with BAIC.

Geely declined to comment on the BAIC-Daimler deal but referred to past statements which said it was committed to long-term investment and healthy collaboration with Daimler.

Daimler shares have lost about 30% of their value since Li Shufu disclosed his stake, hit by a string of profit warnings linked to a slowing auto market and diesel emissions costs.