There are few things worse than spending hours preparing your tax return only to discover that identity thieves have already snatched your refund.

For many people, the misery starts with an error message from their tax software saying that they’ve already submitted a return; for paper filers, a letter from the IRS is usually the red flag. Either way, if thieves come after your tax return, experts say there are a few steps you’ll need to take to deal with the damage.

1. Fill out IRS Form 14039.

“It's the affidavit that tells the IRS that you're a victim of IRS tax return fraud. You can also use it if your identity has ever been compromised or you're a victim of any other type of identity theft,” identity theft expert Carrie Kerskie says.

As soon as you find out there’s a problem, send Form 14039 via certified mail with a return receipt request, so you’ll know that the IRS received it, Kerskie adds. Keep a copy of the form for yourself.

2. Remember your state return.

That may have been compromised as well, so you’ll need to contact your state taxing authority and follow its procedures for reporting the theft. After all, thieves can do a lot of damage with one Social Security number.

“They can only file once with the IRS, but because not all of the states share information and there's no transparency there across the board, they can actually file in multiple states — and not even ones that you reside in,” cautions Eva Casey Velasquez, president and CEO of the Identity Theft Resource Center in San Diego.

3. Shield your credit.

You’re entitled to a free 90-day fraud alert on your credit report if you’re a victim of identity theft. Fraud alerts require businesses to verify your identity before issuing credit, so they may try to contact you before opening new accounts.

After that, you can ask the credit bureaus for a seven-year extension, though that sometimes requires a police report — and those can be hard to get because tax return fraud is usually a federal rather than a local issue, Kerskie says.

A credit freeze may be better because it prevents potential creditors from accessing your credit report, which thwarts attempts to open accounts in your name — though you’ll have to remember to “thaw” your credit report each time you want to use it, Kerskie adds.

6. Prove you’re you.

The IRS may ask you for additional documentation, such as a copy of your driver’s license or utility bills, Kerskie says. “They might have you send a copy of the previous year's tax return, because a criminal should not have that,” she adds. And watch your snail mail, because the IRS doesn’t request personal or financial information from taxpayers by email, text or social media. “You need to stay on top of it,” Kerskie says.

7. Don’t expect a quick resolution.

Once you report the theft, “Your complaint will be reviewed, delaying your refund for months,” security expert Robert Siciliano says. The IRS typically resolves identity theft cases within 120 days, according to the agency.

Velasquez encourages victims to call the IRS’ ID theft hotline (800-908-4490) but says they should be prepared to sit on hold. And there’s no way to estimate how long the whole process will take, she says.

“It's extremely inconsistent. We have talked to people where they have had resolution in just a couple of months, and we have talked to people who have been unable to resolve the issue and it's been over a year,” she says.