From MN 52 (
http://www.accesstoinsight.org/tipitaka ... .than.html" onclick="window.open(this.href);return false; ):
There is the case, householder, where a monk, withdrawn from sensuality, withdrawn from unskillful qualities, enters & remains in the first jhana: rapture & pleasure born from withdrawal, accompanied by directed thought & evaluation. He reflects on this and discerns, 'This first jhana is fabricated & intended. Now whatever is fabricated & intended is inconstant & subject to cessation.' Staying right there, he reaches the ending of the mental fermentations. Or, if not, then — through this very Dhamma-passion, this Dhamma-delight, and from the total wasting away of the first five Fetters[1] — he is due to be reborn [in the Pure Abodes], there to be totally unbound, never again to return from that world.
Ven. Bodhi noted:
Dhammarāgena dhammanandiyā. MA: These two terms signify desire and attachment (chandar̄ga) with respect to serenity and insight. If one is able to discard all desire and attachment concerning serenity and insight, one becomes an arahant; if one cannot discard them, one becomes a non-returner and is reborn in the Pure Abodes.
So the key seems to be the Insight part after emerging from the jhana and penetrate the Three Marks of Existene. If succesful, arahantship; if there're still traces of desire and attachment to the good states, non-return, which's not too shabby...