I came across this sentence -
Although his (Nirmal) detainment (in prison) lasted only a day or two, the experience had a profoundly unsettling effect on Nirmal, following as it did on his rejection by Nilimas's (Nirmal's wife) family and his separation from his own.
I can't understand the meaning of "following as it did". I want to know about the usage and analysis of this wording. I understood the meaning that Nirmal's stay in prison had a great impact on his life, following his separation from both the family.