From the Middle Ages through to the 17th century, Europeans depicted Moors as being black,[1] and referred to them as such. Black Africans were also called Moors and "blackmoors" during the same periods. Ignorant European royalty, courtesans, craftsmen, and peasants did not discriminate between foreign cultures: they were racist against all of them.
[1] https://en.wikipedia.org/wiki/Moor%27s_head_(heraldry)