Getting stronger and losing body fat both play a role in gaining muscle mass. The stronger you are, the more weight you can lift, the more mechanical tension you can place on your muscles.
Additionally, when you can lift more weight for more reps, you can place more metabolic stress on your muscles and create more microtrauma.
These are the three main factors in Getting Jacked (i.e. mechanical tension, metabolic stress, microtrauma).
Additionally, doing a fat loss phase can help prime your body for muscle growth.