^The rule is, if the legitimate government of a post-contact world requests non-military aid from the Federation, then the Prime Directive allows it (although there have been one or two tie-in works that have misunderstood this and claimed that even that was forbidden -- I think the Voyager
novel The Garden
is one). But if the request comes from some other faction, then helping them would be seen as meddling in the world's status quo, since it could shift the balance of power. So the PD says the request has to come from the legitimate government. And of course it can't be military assistance, not unless the world in question is a UFP ally protected by treaty and the threat comes from outside (as seen in TNG: "Redemption"; the PD forbade involvement in a Klingon civil war, but once it was proven that the Romulans were orchestrating a takeover and the threat was actually external, the PD ceased to apply).