Microsoft executives launched a spirited defense of their work with the U.S. military on Friday in a blog post written by company president Brad Smith, who pledged to work with the Pentagon as it embarks on a multibillion-dollar effort to build advanced artificial intelligence capabilities into its operations. founder and chief executive Jeffrey P. Bezos offered a similar statement last week at a conference in San Francisco hosted by Wired Magazine.

“If big tech companies are going to turn their back on the Department of Defense, this country is going to be in trouble,” Bezos said at the conference. (Bezos owns The Washington Post.)

The two companies are responding to a broader wave of discontent that has complicated the efforts of Silicon Valley tech companies to work with the military. Search giant Google recently announced it would disallow its advanced algorithms to be used in weapons systems, and separately said it would decline to bid on a $10 billion opportunity to build the Pentagon’s departmentwide cloud computing infrastructure.

That contract, known as the Joint Enterprise Defense Infrastructure, or “JEDI” for short, is designed to give the Pentagon access to new weapons capabilities that are enabled by artificial intelligence and cloud computing. Amazon, Microsoft, IBM and Oracle submitted bids by the Oct. 12 deadline, company spokespeople confirmed this week, and the Defense Department is expected to award a contract next year. Amazon is seen as a front-runner because of its earlier work handling classified data for the CIA.

The retorts by the executives followed a pair of anonymously written posts on the website Medium over the past month — both of which the site said had been verified by its editorial staff — in which self-described employees of Amazon and Microsoft raised concerns over the tech companies’ relationship with the Defense Department.

The Post could not independently verify the authenticity of the two Medium posts. A Microsoft spokeswoman said the company could not verify the Medium post’s authenticity, and an Amazon spokesman did not immediately respond to requests for comment.

In a blog post titled “Technology and the U.S. military” that was published Friday on Microsoft’s website, Smith wrote that the company would continue to work with the U.S. military while looking for ways to ensure its technology is used responsibly.

“To withdraw from this market is to reduce our opportunity to engage in the public debate about how new technologies can best be used in a responsible way,” Smith wrote. "We are not going to withdraw from the future.”

Smith’s letter also offered a glimpse of how Microsoft is dealing internally with a broader tension in the tech community over the issue. In the letter, Smith wrote that he and chief executive Satya Nadella addressed the issue in a regular Q&A session with employees in which they promised to “support talent mobility” when specific employees don’t want to work on a given project.

“We understand that some of our employees may have different views,” Smith wrote. “We don’t ask or expect everyone who works at Microsoft to support every position the company takes. We also respect the fact that some employees work in or may be citizens of other countries, and they may not want to work on certain projects. As is always the case, if our employees want to work on a different project or team — for whatever reason — we want them to know we support talent mobility.”

His letter went to great lengths to portray the U.S. military as a force for good, noting that “millions of Americans have served and fought in important and just wars,” including freeing enslaved African Americans in the Civil War and liberating European nations in World War II.

“All of us who live in this country depend on its strong defense,” Smith wrote. “The people who serve in our military work for an institution with a vital role and critical history. Of course, no institution is perfect or has an unblemished track record, and this has been true of the U.S. military.”

The letter also noted the concerns of other tech executives who oppose the use of AI and robotics in military weaponry outright, noting “we’ve appreciated that no military in the world wants to wake up to discover that machines have started a war.”

Smith’s letter followed an Oct. 12 “Open Letter to Microsoft” purportedly signed by an unspecified number of Microsoft employees. In the post, which Medium said was verified by its editorial staff, the purported employees argued against bidding on the JEDI contract because the company might not have control over how its algorithms are used to fight wars.

“The contract is massive in scope and shrouded in secrecy, which makes it nearly impossible to know what we as workers would be building,” the post reads. “Many Microsoft employees don’t believe that what we build should be used for waging war.”

In a different Medium post that criticized Amazon’s business selling facial-recognition technology to U.S. law enforcement, an anonymous person purporting to be an employee of the company specifically singled out Amazon Web Services public sector head Teresa Carlson for supporting the law enforcement, defense and intelligence communities.

“We follow in the steps of the Googlers who spoke out against the Maven contract and Microsoft employees who are speaking out against the JEDI contract,” the person wrote. “Regardless of our views on the military, no one should be profiting from ‘increasing the lethality’ of the military,” the person wrote, referencing top defense officials’ rhetoric on the Pentagon’s broader cloud efforts. “We will not silently build technology to oppress and kill people, whether in our country or in others.”

Both companies are likely trying to avoid a broader backlash like the one at Google, in which thousands of Google employees wrote to the company’s chief executive demanding that the company cancel a Defense Department contract to rapidly scan drone footage. While the company did not cancel the contract, it publicly announced it would not renew it. And Google executives cited concerns over ethical uses of artificial intelligence in their decision not to bid on the JEDI contract.