Some of the biggest tech companies pledged to stand up to governments that launch cyberattacks.

On Tuesday, Microsoft, Facebook and 32 other companies signed on to the Cybersecurity Tech Accord, a pact to work together on cybersecurity issues. In addition to stymieing governmental cyberattacks, the companies also agreed to collaborate on stronger defense systems and protect against tampering of their products.

"We called on the world to borrow a page from history in the form of a Digital Geneva Convention, a long-term goal of updating international law to protect people in times of peace from malicious cyberattacks," Microsoft president Brad Smith wrote in a blog post Tuesday.

The financial impact of cybersecurity attacks on businesses and organizations is expected to reach $8 trillion by 2022.

Firms such as Cisco, HP, Nokia, Oracle also joined the accord. Notably, absent from the signers were Apple, Alphabet and Amazon.

Microsoft called for a more uniform approach to protecting users in 2017. The warning came several months before two major ransomware cybersecurity attacks crippled businesses around the world.

Related: Former Google CEO says everyone forgot about criminals when building the internet

In May, WannaCry ransomware targeted more than 300,000 computers in 150 countries, including 48 UK medical facilities. In a bid to help, Microsoft issued patches for old Windows systems, even though it no longer supports them, because so many firms run old software that was vulnerable to the attack. The White House attributed the attack to North Korea.

In June, NotPetya ransomware, which initially targeted computers in Ukraine before spreading, infected computers, locked down their hard drives, and demanded a $300 ransom to be paid in bitcoin. Victims that paid weren't able to recover their files. The British government said Russia was behind the global cyberattack.

"We called on the world to borrow a page from history in the form of a Digital Geneva Convention, a long-term goal of updating international law to protect people in times of peace from malicious cyberattacks," wrote Microsoft president Brad Smith in a blog post on Tuesday.

Github's chief strategy officer Julio Avalos wrote in a separate blog post that "protecting the internet is becoming more urgent every day as more fundamental vulnerabilities in infrastructure are discovered—and in some cases used by government organizations for cyberattacks that threaten to make the internet a theater of war."

"Reaching industry-wide agreement on security principles and collaborating with global technology companies is a crucial step toward securing our future," Avalos added.