Moscow and Tehran have two interests served by facilitating and manipulating terrorists organizations: 1) sustaining the feudal worldview — including in the writing of political theater that is history itself — that in turn sustains each their own medieval leadership and systems of patronage; 2) weakening their enemies by infiltrating them with divisive political subcultures.
Notably, Moscow has refused to designate Hamas and Hezbollah and others as terrorist organizations. The probably reason for that is that the same are subject to “handling” in the interests of the now neo-feudal, neo-imperial Russian state.
Tehran, of course, has a complicated but nonetheless a sponsoring relationship with Hamas and Hezbollah (the URL links to a 2014 U.S. State Department report: BackChannels believes the underlying politics have not changed radically in the two years that have passed).
# # #