You might feel that your financial history is littered with too many big-time mistakes for you to ever qualify for a mortgage loan. Maybe you have a bankruptcy filing in your past. Maybe you’ve lost a home to foreclosure.

It’s true that these financial missteps will make qualifying for a mortgage loan a more challenging task. But they won’t make it impossible, especially if you are patient.

Bankruptcy filings and foreclosures will cause your FICO credit score to plunge, often by 150 or more points. But this damage isn’t permanent, and the hit to your credit score lessens over time.

First, know that these negative judgments don’t remain on your credit reports forever. A foreclosure and Chapter 13 bankruptcy will stay on your report for seven years before disappearing. A Chapter 7 bankruptcy filing will stay on your report for 10 years.

That’s a long time, so don’t expect to qualify for a mortgage in the first year after taking one of these credit hits. But five years after the event? Your credit score may have recovered enough to make qualifying for a mortgage loan a realistic goal.

The key is to practice good financial behavior after your foreclosure or bankruptcy. Most importantly, pay all your bills on time every month, pay off as much credit-card debt as you can and don’t run up new debts with your plastic.