A combination of experimental characterisation techniques and computational modelling has allowed us to gain insight into the molecular features governing structure direction in the synthesis of microporous aluminophosphates. The occlusion of three different structure-directing agents (SDAs), triethylamine (TEA), benzylpyrrolidine (BP) and (S)-(-)-N-benzylpyrrolidine-2-methanol (BPM), within the AFI structure during its crystallisation, together with the simultaneous incorporation of water, has been experimentally measured. We found a higher incorporation of organic molecules in the structure obtained with BPM, while a higher water (and lower organic) content is found for the ones obtained with TEA and BP as SDAs. The computational study provides a thermodynamic explanation for the observed behaviour in terms of the relative stabilisation energy of the SDAs and water molecules within the AFI framework compared with when they are in aqueous solution, and demonstrates that a competition for preferential occupation exists between water and organic SDAs, which is a function of the interaction with the inorganic framework. The lower interaction of TEA and BP molecules with the AFI structure promotes the simultaneous incorporation of water molecules in the 12-membered-ring (MR) channel, to increase the host-guest interaction energy and thus the thermodynamic stability. The presence of strongly interacting methanol groups in the BPM molecules leads to the incorporation of only organic molecules within the 12-MR channels. Our results demonstrate the essential role that water molecules play in the stabilisation of hydrophilic microporous aluminophosphates; a minimum amount of organic SDA is, however, essential for a templating role of the microporous architecture.