Exitus acta probat written by love sick Ovid's Phyllis in her letter to Demophoon is said to be the motto of the Inquisition, the Jesuits, or Machiavelli's demonic invention. The Inquisition had never had this motto. Jesuit moral theologians did have a similarly sounding principle, but its meaning (like Phyllis') is quite different from the modern usage: there is no affirmation that evil deeds are justified through good ends.
...Herman Busembaum, in his 'Medulla Theologiae Moralis' (first published at Frankfort-on-the-Main, 1650) gives this [motto] as a theorem (p. 320). Cum finis est licitus, etiam media sunt licita (when the end is lawful, the means also are lawful); and p. 504: Cui licitus est finis, etiam licent media (for whom the end is lawful, the means are lawful also). The Jesuit Paul Layman, in his 'Theologia Moralis,' lib. III., p. 20 (Munich, 1625), quoting Sanchez, states the proposition in these words: Cui concessus est finis, concessa etiam sunt media ad finem ordinata (to whom the end is permitted, to him also are permitted the means ordered to the end). Louis Wagemann, Jesuit professor of moral theology, in his 'Synopsis Theologiae Moralis' (Innsbruck and Augsburg, 1762) has: Finis determinat moralitatem actus (the end decides the morality of the act). (Facts of Faith, Edwardson, p. 281)
...It is erroneous to assert that the Jesuits, out of moral significance of the ultimate end, coined the maxim. Even though many Jesuit casuists hold that to whomsoever the end is permitted must also the necessary means be allowed, yet the qualification is always added that wrongful means are always to be deprecated. Writes Laymann, Jesuit moral theologian: "The presence of a good purpose lends no goodness to an action in essence bad, but leaves to this action its badness in every way." Gury says that it is never permissible to do the slightest wrong as a means of doing good. Another Jesuit moralist concludes: "The will, if directed towards a morally wrongful object, cannot be made good by virtue of any outward purpose. Whoever, therefore, acknowledges the wrongful nature of theft cannot decide to steal for however good a purpose, without imparting to his will the quality of wrongfulness. If the principle that 'the end justifies the means' is to be interpreted as covering the use if means (actions) which are morally wrong or sinful, then it is to be absolutely repudiated... The Jesuits merely hold, with St Paul (1 Cor 10:31) that morally indifferent or good actions may and should be justified by good intentions. (The Power & Secret of the Jesuits, Fulop-Miller, p. 153)
This Jesuit position is close to that of St Augustine ("Pay no great heed to what a man does, but rather to what he has in mind doing... One and the same matter, measured by the varying purpose behind it, becomes a subject for approbation or abhorrence, merit or condemnation") and St Bernard ("Good will is not shorn of its merit even when the action itself is not good") This is also the Thomist view: the morality of action is determined by its end:
Objection 1. It would seem that the good and evil in human actions are not from the end. For Dionysius says that "nothing acts with a view to evil." If therefore an action were good or evil from its end, no action would be evil.
Reply to Objection 1. The good in view of which one acts is not always a true good; but sometimes it is a true good, sometimes an apparent good. And in the latter event, an evil action results from the end in view.
Objection 2. Further, the goodness of an action is something in the action. But the end is an extrinsic cause. Therefore an action is not said to be good or bad according to its end.
Reply to Objection 2. Although the end is an extrinsic cause, nevertheless due proportion to the end, and relation to the end, are inherent to the action.
Objection 3. Further, a good action may happen to be ordained to an evil end, as when a man gives an alms from vainglory; and conversely, an evil action may happen to be ordained to a good end, as a theft committed in order to give something to the poor. Therefore an action is not good or evil from its end.
Reply to Objection 3. Nothing hinders an action that is good in one of the way mentioned above, from lacking goodness in another way. And thus it may happen that an action which is good in its species or in its circumstances is ordained to an evil end, or vice versa. However, an action is not good simply, unless it is good in all those ways: since "evil results from any single defect, but good from the complete cause." http://www.newadvent.org/summa/2018.htm#article4
"The end justifies the means" is poorly worded rehashing of this idea. The "motto" states that good ensues from the complete cause; it is not sufficient to do good deeds, one has to will good for it to be good. Machiavelli's pragmatism may be disgusting enough, but even he did not put it so bluntly as "the end justifies the means" in the Prince). Rather he claimed that "in the actions of all men, and especially of princes, which it is not prudent to challenge, one judges by the result... The means will always be considered honest, and [the prince] will be praised by everybody because the vulgar are always taken by what a thing seems to be and by what comes of it; and in the world there are only the vulgar." He does not go as far as claiming that the results justify the means; he is saying that the vulgar judge by the results. That is very true.
I suspect that "the ends justify the means" with its queer insistence that "justification" means more than the approbation of the vulgar is modern; it is as modern as Bentham's and Mill's consequentialist ethics. To claim, without the shadow of cynicism, that immoral means are justified by good ends ("the greatest happiness for the greatest number") one has to have the modern mind stretched well beyond what the Inquisition, the Jesuits, and Machiavelly ever dared to assert.
What is the end of believing that "the end justifies the means?"