delivered the opinion of the court,
After reversal of the judgment obtained by the present plaintiff in error against Robert Thorne and his sureties, it was finally determined, on the second trial, in accordance with the judgment of this court, reported in 30 P. F. Smith 15, that the insurance com-*338pa ny had no right to recover the amount of the premiums, &c., for which suit was brought, for the reason that the company, during the time that Thorne, acting as its agent, collected the same, was doing business within this Commonwealth in direct contravention of the law relating to foreign insurance companies. It was held in that ease that the legislature had a clear right to prescribe the conditions under which foreign corporations may do business in this state, and the mode of appointing and qualifying their agents, and that actions, based upon transactions prohibited by the statute cannot be maintained in our courts. The general principle, underlying the decision, is that courts will not aid a party in an action grounded on an immoral or illegal act; and it is right that it should be so, because if foreign insurance companies were aided by our courts in gathering the fruits of their illegal acts done in palpable violation of the statute, it would soon become practically a dead letter as to many of them.
For the reasons stated, it was thus definitively settled that the Travellers’ Insurance Company had no legal claim upon the bond against either Thorne or his sureties for the premiums collected by him ; and it is difficult to understand upon what principle of equity or sound morality the company could claim to collect and retain, as against one of the sureties, money which represented the fruit of illegal transactions.
The first writ of error sued out by Thorne and his sureties was non prossed by this court in 1874, whereupon the record was remitted and an execution was issued, upon which, according to the sheriff’s return, the money was collected from John Heath, one of the sureties. An alias writ of error was then purchased, and upon it, in 1875, the judgment was reversed and a venire facias de novo awarded. The new trial resulted in a verdict and final judgment in favor of Thorne and his sureties, as above stated. The present action was then brought by John Heath to recover back the money which he was compelled to pay on the execution, and to which, according to the final judgment of the court, the defendant company had no legal claim.
The first assignment of error is the refusal of the court to charge “ That compulsion, in this case, under the evidence, would be a levy upon the property of Heath and a payment by him to relieve his property from the levy ; and if no such levy was made, and he without that paid the debt, the verdict must be for the defendant.” The second is the refusal of the court to charge, “ That the return of the sheriff, ‘money made; paid by John Heath,’ implies a voluntary payment, and that the return of the sheriff being of record, is conclusive, and John Heath cannot recover in this case.”'
The' substance of the contention in these two assignments, together with the ninth, is that, inasmuch as it does not appear *339that a levy was actually made on the property of Heath before he paid the money to the sheriff, the payment was voluntary, and therefore he could not recover. We cannot assent to this proposition. The first writ of error, by which the execution had theretofore been restrained, was non grossed, the execution was issued and at once became a lien on all of Heath’s personal property in the county from the time it was placed in the sheriff’s hands. Heath had no alternative but to pay the money or submit to the seizure and sale of his property. Under these circumstances, payment of the money to the sheriff on the execution was not, in any proper sense of the term, a voluntary payment; on the contrary, it was under stress of the execution, and therefore compulsory. The learned judge had affirmed defendant’s first point, “ That a payment without compulsion is a voluntary payment, and if the jury find the alleged payment by Heath to have been made without compulsion, they must find for the defendant.” The question was thus, by defendant’s request, submitted to the jury; but in any aspect of the case, there was no error in refusing to affirm the second and third points, or in charging as complained of in the ninth assignment.
The third, fourth and fifth assignments are not sustained. The principle involved in the third was broadly settled in Thorne et al. v. Insurance Co., supra; nor does his recognisance, entered into when he took the first writ of error, or the nonprossing of the writ stand in the way of his recovery. The money which he seeks to recover back was not collected under the recognisance, but on the execution issued on the original judgment.
The contention in the sixth assignment is that the refusal of this court to grant a writ of restitution immediately upon the reversal of the first judgment is a bar to this action. We do not think so. Restitution is not always of right; it is frequently a matter of grace, and the refusal to grant the writ before the second trial was had, and the right of the insurance company to recover the amount of premiums collected finally determined, cannot be a bar to the present suit instituted after the first was ended. In Harger v. Commissioners of Washington Co., 2 Jones 251, it is said, “ Restitution is not of mere right. It is ex gratia, resting in the exercise of a sound discretion, and the court will not order it where the justice of the case does not call for it.” In refusing the order of restitution the court may have been influenced by the fact apparent on the record, that the plaintiff in error was guilty of laches in not prosecuting his first writ of error, and permitting the same to be non prossed, whereby he lost the benefit of his writ as a supersedeas ; but, on whatever ground it may have been refused, we are of opinion that the refusal at the time and under the circumstances is not a bar to the present action.
What has already been said is a sufficient answer to the seventh *340and eighth assignments, both of which present the general question of the right of the plaintiff below to recover. The general principle undoubtedly is, that money collected or paid upon lawful process of execution cannot be recovered back, though not justly or lawfully due by the defendant in the execution to the plaintiff. Cases in which the principle is recognised are numerous, but in none of them is the reason more clearly and forcibly stated than in Federal Insurance Company v. Robinson, 1 Norris 359. They are cases in which the judgment on which the execution issued was never reversed or vacated.'- Where, as in the case before us, the judgment which supported .the execution has not only been reversed, but, on a retrial, final judgment has been entered in favor of the opposite party, the principle does not apply. In Duncan v. Kirkpatrick, 13 S. & R. 292, Chief: Justice Gibson remarks “that assumpsit is the proper action when the money has been received under a judgment which has been reversed;” but he restricts its application to cases of reversal without' any order of restitution.
The offer which is the subject of complaint in the last assignment was properly rejected.
Judgment affirmed.