Two questions:
Is it sexism to discriminate by insisting upon hiring only a male for a role, instead of simply the most qualified person?
Is it sexism to discriminate by insisting upon hiring only a female for a role, instead of simply the most qualified person?
To answer your two questions, Yes, and Yes. In your cases, sex was part of the equation. As soon as you say "only a male" or "only a female" you open the door as sexist.