Joseph was a 'just' man, but his understanding of justice was about to be tested in the most profound way. What does it truly mean to be righteous when faced with an unimaginable situation?
The word 'just' (or 'righteous') here, dikaios in Greek, doesn't just mean someone who follows rules to the letter. While Joseph was certainly devoted to God's law, the context reveals a deeper meaning. Faced with Mary's pregnancy, his 'justice' compelled him to consider the legal consequences: divorce, and potentially even death by stoning, as prescribed by the Law for adultery or breach of betrothal.
However, his dikaios nature also encompassed mercy and tenderness. He wasn't willing to inflict the harshest penalty, the public shame and potential execution, on Mary. This wasn't a contradiction, but a reflection of a mature understanding of righteousness – one that balances adherence to law with compassion for the individual, especially when facing circumstances that are not fully understood.