In regard to the clarification about the history of Twelver Shia branch, it could be profitable to know that there are various viewpoint regarding the appearance of Shia.
Imamiah Shia believe that the initial seed of Shiite has made by
(Shia Shenasi wa pasokh be Shobahat)
ر.ک: رضوانى، على اصغر، شیعه شناسى و پاسخ به شبهات، ج 1، ص 39 – 41،
تهران، نشر مشعر، چاپ دوم، 1384ش
and the Prophet (blessings of Allah be upon him and his family ) . Helped that during the period of his prophetic mission.
(Al-Shia fel Islam, page21) / طباطبائى، سیدمحمد حسین، الشیعة فی الإسلام، ص 21، بیروت، بیت الکاتب،
چاپ اول، 1999م؛ سبحانی، جعفر، الأضواء على عقائد الشیعة الإمامیة، ص:
17 – 18، قم، مؤسسه امام صادق(ع)؛ حکیم، سید محمد باقر،
Therefore it has been resulted at the era of Prophet Muhammad (SAWW) and that’s why some people at the time of the Prophet (SAWW) were famous as this name, Such as: Salman-Farsi, Abuzar-Qafari, and Meqdad-ibn-Aswad.
- A group of Sahabah at the time of the Prophet (SAWW) made their belief to him (Imam Ali (a.s.)) by hearing the verses and traditions
Regarding the order of Imamate and Welayah of Imam Ali (peace be upon
him) . That group became famous as Shia since that time. Ibn Khaldun Says: A group of the Sahabah were Shia of Imam Ali (a.s.) and knew him as a
Person who was more competent in compare with others for the caliphate
According to some narrations, Prophet Muhammad (صلی الله علیه و آله و سلم ) gave the title of Shia to the followers of Amir-al-Momenin Ali (a.s.), like:
«وَ الَّذِی نَفْسِی بِیَدِهِ، إِنَّ هَذَا وَ شِیعَتَهُ لَهُمُ
الْفَائِزُونَ یَوْمَ الْقِیَامَة»
(I swear) I my Allah that my life is in his hands that this (Imam-Ali)
and his followers will be saved at the doomsday.
ابن عقده کوفی، احمد بن محمد، فضائل أمیر المؤمنین(ع)، محقق، حرز الدین،
عبد الرزاق محمد حسین، ص 219، قم، دلیل ما، چاپ اول، 1424ق؛ شیخ طوسی،
محمد بن حسن، الأمالی، ص 251، قم، دار الثقافة، چاپ اول، 1414ق.
Of course there are other viewpoints regarding the appearance of Shiite such as:
- A group believe that Shiite is related to the end of the period of
Othman caliphate …
- A group believe that Shiite has appeared at the day of Fetnatul-Daar
(the day of the murder of 3rd caliph )
- A group believe that Shiite appeared after the issue of Hakamiah to
martyrdom of Imam Ali (a.s.)
- A group believe that the start of the appearance of Shiite is related
to the event of Karbala and the martyrdom of Imam Hussain.
With respect to your last question which inquired “does this claim that Safavid Empire in Persia was the main reason for the Twelver Shi'ism becoming the mainstream Shia sect has anything to do with reality?”
It could be profitable to point that appearance of a religion (Mazhab) is not feasible to be occurred at once, actually this is a matter which is done gradually. So we cannot term it related to any specific period such as Safaviah(Safavid) . On the whole, the events which occurred during ten centuries, could be considered as the main reason of the appearance of Shia in Iran.