The Fujiwaras always stayed in power  because they carefully constructed familial marriages and arrangements as to forever have male family at the throne.
By marrying his daughters to sons of the reigning emperor and then engineering timely abdications, a Fujiwara contrived always to be father-in-law, uncle, or grandfather behind the throne.