Leaders who are weakened domestically often undertake risky policies to avoid undesirable developments for them personally. The fear of removal from office due to poor performance or bad luck may prompt a leader to instigate a diversionary war (or some other risky course of action) that he or she might not rationally have started, in the hope that should it go well he or she would stay in power, or at least achieve a surge in personal popularity and patriotism to sustain them in power.
Leaders who are weakened domestically may resort to risky policies to avoid personal failures. The fear of losing their positions due to poor performance or bad luck might lead a leader to launch diversionary wars (or other high-risk actions) that they wouldn't logically pursue, hoping it will help them maintain power or increase their popularity and national sentiment.