Firstly: FOR RECTIFYING AND PUNISHING THE SHIAS AND RATHER ALL THE OTHERS:
If a Prophet or an Imam is present among a nation and that nation does not rise for his obligatory rights or does not obey his commands and in short, the Prophet's invitation leaves no impression on the nation and rather they exceed the limit and cause harm to their Prophet, it is permissable for the Prophet to abandon and isolate his nation so that in this manner he rectifies his nation. Perhaps in this manner, the nation concerned would stop its rebellion and begin to adopt the path of guidance. Perhaps they would seek benefit from the Prophet existence and an Imam too would act as a preacher, guide, leader and the one inviting the people. The Divine saying: ---
stems from this very aspect.
When isolation and abandonment of invitation becomes the means for rectifying a nation then it is prudent to do the same even though people may be unaware of this matter. Moreover it would be beneficial to them even though they may not possess understanding of the same. This isolation and abondonment of invitation does not possess any fixed limit and boundaries and in fact, one cannot say anything about their limit. Rather its limit and duration depends on the nation turning back from its deviated path and becoming enlightened after heedlessness. It depends on the people's awareness of the benefits of the presence of the Prophet or an Imam.
History bears witness that Ahl-e-Bayt, Revealation, Messengership and Aal-e-Muhammad had to face too many calamities such as: Hardship, suffering and non-revolt for the sake of the people instead of that right which Allah had set as the reward of his Messengership. Surely, they were always subjected to severe persecution and pressure such as being taken captive, imprisoned, hanged, expatriated, exiled and dispersed here and there.
Mahdi, the Expected one is aware of all such matters and knows that he too would be subjected to such cruelties and oppression. Rather, it would be much more sever, greater and bitter in nature because people are aware of Hazrat's objectives and are aware that Hazrat would give orders to rise with their arms. Thus Mahdi has isolated himself from the nation because he knows that he would receive the same treatment as his father, fore-fathers, cousins, and relatives had received. Besides, Hazrat's objectives are nothing but to train the nation, make them aware, bring them back on the path of guidance and to seek his own just right. The author of Elalush-Sharaye has narrated a tradition from Imam Muhammad Baqer (A.S.) as such: 'When Allah does not Wish that we should remain amongst a group, He holds us back from them.'