Section 57 of Contract Act, 1872
Reciprocal promises to do things legal, and also other things illegal
Where persons reciprocally promise, firstly, to do certain things which are legal, an, secondly, under specified circumstances, to do certain other things which are illegal, the first set of promise is a contract, but the second is a void agreement.
A and B agree that A shall sell B a house for 10,000 rupees, but that, if B uses it as a gambling house, he shall pay A 50,000 rupees for it.
The first set of reciprocal promises, namely, to sell the house and to pay 10,000 rupees for it, is a contract.
The second set is for an unlawful object, namely, that B may use the house as a gambling house, and is a void agreement.