The Clean Development Mechanism of the Kyoto Protocol provides the opportunity for smallholders to receive financial rewards for adopting tree-based systems that are sustainable. In this paper a meta-model is developed to simulate interactions between trees, crops and soils under a range of management regimes for a smallholding in Sumatra. The model is used within a dynamic-programming algorithm to determine optimal tree/crop areas, tree-rotation lengths, firewood-harvest and fertilizer application rates for a landholder faced with deteriorating land quality and opportunities to receive carbon credits and fertiliser subsidies. It is found th at profit maximising management strategies depend on initial soil quality. For example, incentives to participate in carbon projects only exist when the soil is degraded because the opportunity cost of the forgone crop production is low. Also, when soil-carbon stocks are low only trees should be grown and residues added to the soil to increase carbon stocks until a threshold level is reached, when it becomes optimal to switch to a steady-state system of crops with fertiliser. In this case, tree rotation lengths depend on carbon and fertiliser prices; where increases in these prices decrease the opportunity cost of growing trees and allow for longer rotations. If, however, the initial soil-carbon stock is high, the profit-maximising strategy is to grow only crops and use fertiliser, which initially depletes the soil of carbon until a steady state is reached and maintained.