Suppose a transaction is lawful in its basic type but is accompanied by a prohibited condition. That differs from an act whose essential nature is not recognized as legally valid. The distinction between intrinsically prohibited and prohibited due to an attached matter is crucial.
An unlawful contract condition does not by itself answer every question about legal effects. One must ask whether the prohibition targets the core legal act or an accompanying feature. The Hanafi distinction between invalid and defective transactions matters here.
Caution: The effects in an actual transaction may depend on its type, possession, and other details; this conceptual exercise is not a universal transaction ruling.