Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:15:94

Then declare what you are commanded and turn away from the polytheists.  

So proclaim, O Muhammad (s), what you have been commanded, to ˹proclaim˺, in other words, declare it openly and carry it out, and turn away from the idolaters — this was ˹revealed˺ before the command to struggle ˹against the idolaters˺.
القرآن:١٥:٩٤

فَاصْدَعْ بِمَا تُؤْمَرُ وَأَعْرِضْ عَنِ الْمُشْرِكِينَ  

{فاصدع} يا محمد {بما تؤمر} به أي اجهر به وأمضه {وأعرض عن المشركين} هذا قبل الأمر بالجهاد.