I would say it’s a complex subject.
How does one judge a concept like a religion? Do you judge the people who express their association with the label? Anyone can take on a label and be viewed as a representative of that label - sure, you can have organisations like the Catholic Church ex-communicating people, but that’s only within the organisation… it’s no different to someone declaring someone else a sinner. A label (sinner, excommunicated) only has value if one accepts it.
Even when labels like “Jewish” are conditional based on genetic heritage, it doesn’t stop someone claiming that label even if they don’t qualify.
Anyone claiming that a label has been mis-applied by a person is just presenting a difference of opinion - it becomes a “no true Scotsman” claim if applied generally, or a “he said, she said” if applied individually.
If you instead say, “how about we focus on the written text(s) that define(s) the religion?”, you then have the problem of interpretation. The extremists can interpret a text in a manner that suits their extremist views, does that then mean that the most extreme interpretation counts?
One might argue that if a scripture can be interpreted in an extreme way, then it can’t qualify as peaceful; but then one could point out that flat-earthers interpret empirical data as either proving a flat earth or failing to prove a spherical earth, but it would be illogical to accept that extreme interpretation as valid, so logically, judgement based on possible interpretations is not a fair measure either.
I would go down the legal example personally - consider that in the majority of various legal systems around the world, there is no objective measure of guilt or innocence associated with specific crimes - there is a judge and often a jury, a defence and prosecution, and each case is heard on its own merit.
A judgement of whether a religion is peaceful or not needs to take into consideration the scripture(s) / written text(s) of that religion, the various interpretations and whether those interpretations are reasonable; the behaviour of the majority of adherents in comparison to an equivalent control group, and whether the “fringe” elements (extremism) are at a higher or lower ratio compared to an equivalent control group.
At present, a comparison with a “non-religious” control group would be difficult because there is a significant disparity in numbers - most of the world’s population is religious, so comparing a smaller number of non-religious to a much larger number of religious could produce lower quality results.
You also have the issue of cultural disparity - if the non-religious group has greater numbers in a particular region (i.e., the west) and clustered around certain demographics (education, etc.), it’s not a fair control group.
That said, in addressing the specific question:
The term “Islam is a religion of peace” is a post 9/11 slogan, and not something doctrinally stated, though proponents of Islam do make the case that key verses in the Quran establish this position (but not directly stated as such)
One notable feature of religious texts is that they provide historic accounts - i.e., in the Quran, there are a number of battles/wars referenced and directions/instructions given to the persons fighting in these conflicts.
I would say that if a verse cites an instruction/direction given, that in that context as a historical account, and even though limited to that specific event, the instruction/direction can reasonably be taken at its face value, even if its application as a verse to future instances is subject to interpretation and the wider conflict.
To put that in a clearer way, If a verse detailing a conflict has an order given, “Do X”, then “X” should be taken on face value for the purposes of that conflict, even if it is open to interpretation for a future follower.
In the Quran, there is at least one verse (the “sword verse”) that features an instruction given in conflict for forced conversion:
“9:5 But once the Sacred Months have passed, kill the polytheists ˹who violated their treaties˺ wherever you find them, capture them, besiege them, and lie in wait for them on every way. But if they repent, perform prayers, and pay alms-tax, then set them free. Indeed, Allah is All-Forgiving, Most Merciful.”
I would say that even though it is in the context of a specific context, forced conversion runs antithetical to a religion of peace.
While not as authoritative as the Quran, the Hadiths contain more damning verses like:
Sahih Bukhari 6924 “Whoever changes his Islamic religion, kill him.”
and
Sahih Muslim 22, Book 1 Hadith 36 “I have been commanded to fight against people till they testify that there is no god but Allah, that Muhammad is the messenger of Allah, and they establish prayer, and pay Zakat and if they do it, their blood and property are guaranteed protection on my behalf except when justified by law, and their affairs rest with Allah.”
Some argue that the 6924 verse only applies to people who have committed treason, however the problem with that argument is that it becomes circular - the act of changing from the Islamic religion in that time was considered and treated as treason, so the argument that it was only for people guilty of treason is misrepresentative.
On this basis, I would say that however it may be argued Islam is viewed today; in the time of its conception and during the timeline the writings cover, there are evidently actions - instructions and commands - described that are contrary to it being a religion of peace at that time.