The characters combine to create a powerful image: “To repay the country [报国] with the most essential and pure loyalty [精忠].”
The soul of `精忠报国` comes from the story of Yue Fei (岳飞), a celebrated general from the Southern Song Dynasty (1127–1279). As legend has it, when Yue Fei was a young man, his mother worried that he might be tempted by corruption or fear in his duty to defend China from northern invaders. To instill in him an unbreakable sense of purpose, she tattooed these four characters—`精忠报国`—onto his back with a needle. This act became the ultimate symbol of a mother's patriotic wish and a son's unwavering duty. Yue Fei went on to become a brilliant and incorruptible general, but was ultimately executed due to political intrigue by treacherous court officials. His tragic story cemented `精忠报国` in the Chinese psyche as the pinnacle of patriotic virtue, often in defiance of personal safety or corrupt authority.
This is a highly formal and reverent idiom. You would not use it in casual conversation. Its use is reserved for serious and honorable contexts.