For three years, Rasulullah (sallallahu ‘alaihi wasallam) continued inviting people to Islam secretly and people gradually embraced Islam. After this period of three years, the following command was revealed, instructing Rasulullah (sallallahu ‘alaihi wasallam) to invite to Islam openly:
فَاصۡدَعۡ بِمَا تُؤۡمَرُ وَ اَعۡرِضۡ عَنِ الۡمُشۡرِکِیۡنَ
Then proclaim openly that which you have been instructed (i.e. Islam) and turn away from the disbelievers (Surah Hijr v. 94)
وَ اَنۡذِرۡ عَشِیۡرَتَکَ الۡاَقۡرَبِیۡنَ وَاخۡفِضۡ جَنَاحَکَ لِمَنِ اتَّبَعَکَ مِنَ الۡمُؤۡمِنِیۡنَ
And warn your close relatives and treat those believers who have followed you with affection and kindness (Surah Shu‘araa v. 214-215)
وَ قُلۡ اِنِّیۡۤ اَنَا النَّذِیۡرُ الۡمُبِیۡنُ
And say (O Muhammed) I am indeed an open warner (Surah Hijr v. 89)
(Extracted from Seeratul Mustafa 1/171)