After working together for years to build and test solar-based batteries for homes and businesses, Tesla has agreed to buy SolarCity — which is already chaired by CEO Elon Musk — for $2.6 billion.

Tesla announced in a regulatory filing [PDF] on Monday that it had reached a deal with SolarCity to combine the electric car company with its solar-energy sister company in an all-stock transaction.

The deal must still be approved by a majority of SolarCity stockholders, directors, and executives of both companies — some of them not named Musk. SolarCity shareholders will receive $25.83/share plus about one-tenth of a share of Tesla.

According to the regulatory filing, the Board of Directors for Tesla — with Musk and two other executives recusing themselves from the discussion, determined the merger was in the best interest for both companies.

Tesla and SolarCity said on Monday that they believe the combined company will realize $150 million in cost savings in the first full year after the deal closes.

The deal comes a month after Musk suggested combining the two companies, for which he owns a 20% stake in each, in order to better integrate Tesla’s battery-storage aspects with SolarCity’s solar panel expertise, the Wall Street Journal reports.

“It’s really all part of solving the sustainable energy problem,” Musk said. “That’s why we are all doing this to accelerate the advent of a sustainable energy world.”

Tesla and SolarCity have worked together on several initiatives in recent years, making the merger a natural move for the two companies.

In April 2014, Tesla announced that it had partnered with SolarCity to test a new line of batteries at 11 Walmart stores in California.

Additionally, Musk has strong family ties to both companies. While Musk is chairman for both companies, the WSJ reports his cousins founded SolarCity and sit on the board.

[via The Wall Street Journal]