Bill Gates, co-founder and former CEO of Microsoft, says he talked to Google researchers on Monday about the application of artificial-intelligence technology in health care.

The intersection of AI and health care is a longtime area of interest for Google. Researchers there have explored the use of AI algorithms for making predictions based on medical records. And Verily, another subsidiary of Alphabet alongside Google, is solely focused on health care. While Microsoft and Google are arch-competitors in many areas, including cloud computing and artificial intelligence research, the visit is an example of how Gates' broad interest in technology trumps Microsoft's historical rivalries with other tech companies.

Gates brought up the visit spontaneously after a person in the audience at the Human-Centered Artificial Intelligence Symposium at Stanford University in California, held near Google's Mountain View headquarters, asked him about how to ensure that AI will operate ethically.

Gates talked about the use of AI in weapons systems and autonomous vehicles before arriving at the subject of health care.

"In the medical field, you know, we just don't have doctors. Most people are born and die in Africa without coming near to a doctor," said Gates, who is co-chair of the nonprofit Bill & Melinda Gates Foundation, which concerns itself with improving global health among other things.

"We're doing a lot of work with analyzing ultrasound, and we can do things like sex-blind the output, because we're not having anybody actually see the image. We can tell you what's going on without revealing the gender, which is, of course -- when you do that, it drives gendercide. And yet, we're doing the analysis, the medical understanding, in a much deeper way, and that's an example where it's all done with a lot of machine learning.

"I was meeting with the guys at Google who are helping us with this this morning, and there's some incredible promise in that field, where, in the primary health-care system, the amount of sophistication to do diagnosis and understand, for example, 'Is this a high-risk pregnancy?' 'Yes.' 'Let's escalate that person to go to the hospital level,' even though you couldn't afford to do that on a widespread basis. So this stuff is going to be very domain-specific."

In his talk on Monday Gates pointed to an interest in the potential of AI much earlier in his life.

"When I started Microsoft, I literally wrote a note to my parents, and I said, 'Okay, I may miss a bunch of breakthroughs in AI, and that'll be what I give up to create this company, but oh, well,'" he said. "Well, for about 20 years, I didn't miss much. More recently, there's amazing things going on, and fortunately, Microsoft has gotten to a size that it, along with Google and many others, get to participate."

Google didn't respond to a request for comment on Gates' visit.

WATCH: Melinda Gates on global health and eliminating poverty