Life is seldom black and white. Even in matters of moral values, there are times we need to prioritize one value over others. In Halacha is also nuanced and at times we must prioritize one halacha over another. How we prioritize values and halacha is a skill we develop through the learning of Gemara.