Searches in Safari and possible virus Warning, a virus?

I have made a search in Safari address bar. I put marqueting (marketing in catalan language) I have been redirected to a page that says:

(Now I am in Spain and this is my translation of the message, as far as I know:)

    WARNING!

    Mac OS X 10.12.5 is infected with viruses and other malicious applications.  
Viruses must be removed and damage to the system must be repaired.

    You need to run the virus removal procedure immediately.

    ** If you leave this site, your Mac OS X Sierra will remain damaged and vulnerable **

    The address is (only the beginning):   
    http://mac-shield.com-secure.download/result/e3fk6/?sourceid=


I suppose that the message itself must be malicious. I post it just to be sure and to help and prevent others. Why it happened just making a search? how to solve it, should just ignore it? How to avoid that in future searches?
This is a scam site.  You'll be ok as long as you didn't fall for their tactics and download and install their software.  There's nothing to remove from your system if you didn't install anything.

The info below is from a 2011 article on Bleeping Computer so that tells you how long this type of phishing scam has been going on.


  Mac Shield is a fake rogue anti-spyware program that for the Mac OS
  operating system from the same family as Mac Guard. This infection is
  spread through spam, hacked sites that have poisoned the search
  results for image search engines such as Google Images, and hacked
  sites that infect you when you visit them. When you click on images
  belonging to the hacked sites, you will automatically be redirected to
  a page that shows an advertisement that pretends to be a fake online
  scanner.


I'm not sure why you got this result page in the first place.  Are you using your normal internet gateway and service provider?  A free Internet cafe or something similar?

Make sure you clear Safari's cache and browser history.