Detroit automakers that viewed Silicon Valley as a “serious threat” just a few years ago are now jumping into deals, acquisitions and investments with West Coast tech companies, describing some of the partnerships as “getting married.”

The new relationships promise to bring the tech and automotive industries closer as they rush to develop self-driving cars, ride-sharing partnerships and to take advantage of other cutting-edge technology.

The change from potential adversaries to partnerships illustrates a growing awareness that neither industry is likely to conquer the other anytime soon and that they need each other to evolve at the speed necessary to remain competitive.

In less than a month, the Detroit Three automakers — General Motors, Fiat Chrysler Automobiles and Ford — have all inked high-profile deals with Silicon Valley-based companies:

•On Friday, GM completed its acquisition of Cruise Automation, a 3-year-old San Francisco start-up, for an estimated $1 billion.

•Fiat Chrysler reached a deal to build 100 Chrysler Pacifica hybrid minivans for Google’s Self-Driving Car Project on May 3.

•Ford announced two weeks ago it has invested $182 million to fund and collaborate on software development with San Francisco-based Pivotal.

But like any successful marriage, the two parties must recognize their differences and figure out how to work more closely together, said Xavier Mosquet, a Detroit-based senior partner in the automotive practice of the Boston Consulting Group. These are industries that move at vastly different paces, operate in entirely different regulatory environments and come from different corporate cultures, he pointed out.

“A number of Silicon Valley companies have been looking for areas of expansion. … And so in general, there has been a lot of money invested in mobility in the valley,” Mosquet said. “We are right now at the convergence of the traditional automotive industry with new software and electronics models, and new mobility models.”

Fiat Chrysler CEO Sergio Marchionne defined the Google deal as “a marriage of capability of the car as a vehicle and the technical support” necessary for a self-driving vehicle.

It’s important to note that both companies remain free to work with other companies and Google is not willing to share the secrets of its technology. FCA said the new Pacifica is a perfect vehicle  for the partnership because the minivan has the necessary electrical infrastructure and allows Google to test its technology in a vehicle that can transport a number of passengers.

The tech-auto partnership trend is global with German automakers also pairing up with technology companies.

And on Friday, Apple announced it is investing $1 billion in Didi, Uber’s biggest ride-sharing competitor in China. The investment immediately sparked renewed speculation that Apple is working on some kind of electric car — a project Tesla CEO Elon Musk has called an “open secret” in Silicon Valley.

John Murphy, an analyst for Bank of America — Merrill Lynch, said much of what’s happening now is that automakers are putting the building blocks in place to build truly autonomous vehicles.

Murphy said self-driving cars have the potential to eventually improve the speed at which cars can travel safely, which could in turn lead to tremendous demand for vehicles with that capability and could lead to an increase in revenue and profits for automakers.

“If you can get me from A to B in twice the speed or half the time, I am going to pay you a lot of money for that,” Murphy said.

In some cases, the relationships between Detroit and Silicon Valley have evolved from a supplier-customer relationship into full-fledged partnerships.

That’s the case with Ford and Pivotal, which have been working together for about 2 1/2 years. Pivotal helped Ford develop FordPass, a free service that allows customers to access vehicle features from a smartphone and to reserve parking and pay bills, among other features.

Ford CEO Mark Fields said the automaker’s engineers will be working with Pivotal software engineers in software development labs, an evolution of the partnership.

“It’s kind of like going from dating to getting married,” Fields said. “When you get married, you are much more open to sharing and learning from each other.”

Pivotal CEO Rob Mee said the cultural fit is far more comfortable than most would expect.

“Ford is super open-minded and very eager to learn these things,” Mee said. “From that standpoint, it is a great fit. Their sharing culture is similar to our own.”

The mind-set of Detroit’s automakers has changed swiftly.

In 2014, Mark Reuss, GM’s executive vice president of global product development, said Google parent company Alphabet could become a “serious competitive threat” to the auto industry because of its self-driving car project launched in 2009.

And while Reuss might still have that view of Google, GM is moving more aggressively than most automakers to join forces with Silicon Valley companies.

Its acquisition of Cruise Automation gives GM access to develop a “highway autopilot” product that may become a crucial piece of technology in the quest to bring a fully autonomous car to market. Cruise will continue to operate from San Francisco with co-founder Kyle Vogt reporting to GM’s recently formed autonomous vehicle development team led by Doug Parks, GM vice president of autonomous technology.

In January, GM said it would invest $500 million in ride-sharing service Lyft, which is based in San Francisco. Earlier this month, GM and Lyft said they will test a fleet of autonomous cars that might include the Chevrolet Bolt EV within a year.

GM CEO Mary Barra told TechCrunch in January that the automaker and Lyft have a “shared vision” and can introduce services to customers faster by working together.

But even with all good intentions, Mosquet said the two industries do face cultural challenges as they work with each other.

“I think the auto industry, at some points, has been too slow. But you can see … many car manufacturers are changing their pace,” Mosquet said. “At the same time, we are in an industry where safety and regulations are serious matters. And tech companies will have to learn what it means to operate in this environment.”

Two assumptions underlie the rationale for partnerships and deals between the two industries: Tech companies don’t want to get into the business of making cars and the two industries need each other to make self-driving cars work well.

“It takes many parts and partners to make a self-driving car,” John Krafcik, CEO of Google’s Self-Driving Car project said in January. “You can’t do it alone.”

Still, automakers are at a major disadvantage when they deal with the tech industry, Marchionne said earlier this month.

Marchionne noted that the market capitalization of automakers is a fraction of the value Wall Street assigns to tech companies.

Google parent Alphabet’s market capitalization — the total dollar market value of all of a company’s outstanding shares — is $490 billion compared with just $9.8 billion for FCA.

“We appear to be on the wrong end of the wealth distribution curve,” Marchionne said. “Some (tech companies) can buy us out of petty cash. And so it’s almost an unfair match when they decide to come in and participate with us.”

Marchionne portrayed the agreement to build 100 minivans for Google as a “very targeted” deal that has the potential to evolve into something much bigger.

“I think walking in a collaborative fashion with people who have historically been viewed as intruders and potential enemies of our business — walking with them at their speed is the best possible solution for us,” Marchionne said.