Uncle Sam can be one generous dude.

He allows workers, in the public and private sectors, to be away from their jobs for five years without losing their gigs, if they are on temporary military duty.

On top of that, some assignments — fighting in a war is one — don’t count toward the five years. That means some employees who also are in the military could be missing in action from their civilian jobs for a really long time and not be fired.

At least in theory.

The U.S. Postal Service apparently wasn’t up to speed on Sam’s generous spirit, as defined by federal law, when it fired Richard Erickson, a decorated sergeant major in the Army’s Special Forces, in April 2000.

Now the U.S. Court of Appeals for the Federal Circuit has overturned a Merit Systems Protection Board ruling in favor of USPS that Erickson, an Afghanistan war veteran, had abandoned the post office for military service.

The decision appears to pave the way for Erickson to get his job back, though the Postal Service hasn’t surrendered yet. Erickson’s attorney says the case could have broad implications for thousands of vets. The court sent the case back to MSPB for further action.

The lawyer, Mathew B. Tully, said he has had preliminary discussions about settling the case with the Postal Service. At the same time, he predicts that in light of the court ruling, the MSPB will tell USPS to give Erickson his job back.

“I think MSPB is handcuffed,” said Tully, who also is a lieutenant colonel in the New York National Guard. “I think the only thing they can do is order his back pay and reinstatement from the day he got fired.”

Erickson could be eligible for 11 years of back pay and compensation for benefits. With legal fees added, Tully figures USPS might have to dish out more than $1 million.

The Postal Service doesn’t agree.

“We will engage Mr. Erickson at MSPB,” said Gerald McKiernan, a USPS spokesman. “Based on two previous MSPB decisions and a federal circuit court decision, we believe we acted properly at the time.” There are no immediate plans to rehire Erickson, he added.

A MSPB spokesmen said the court’s decision is under consideration.

Erickson may not have abandoned his job, but he was gone quite a bit after he began working as a postal clerk in Fort Myers, Fla., in 1988.

“Throughout his employment with the USPS, Mr. Erickson also served as an Army National Guard Reservist,” according to the agency’s brief. “As a result of his military service, Mr. Erickson was absent from his USPS position for six months in 1991, six months in 1992, three months in 1993, two months in 1994, and five and a half months in 1995. During a four-year period beginning on May 25, 1996, and up to the date of his removal on April 7, 2000, Mr. Erickson was on military leave and worked all of four days in his USPS position, and none after December 24, 1996.”

That kind of attendance record would understandably get anyone fired.

But if you are on military service, you are protected by the Uniformed Services Employment and Reemployment Rights Act, better known as USERRA, which allows for five years of absence.

The court said: “Importantly, Mr. Erickson’s period of military service did not exceed the five-year limit, taking into account the statutory exclusions. . . . The Postal Service, however, apparently believed that his military service had exceeded the five-year period and predicated his removal on that assumption. Thus, the Postal Service’s stated reason for removing Mr. Erickson— excessive use of military leave — was improper.”

Erickson, a single father with three girls, said he has had a hard time finding work since the Postal Service fired him.

“It’s been very difficult,” he said. “I wasn’t able to get a job anywhere because I was red-flagged by the post office.”

Plus, his Special Forces skill set wasn’t easily transferrable to the civilian market.

Except for reality television.

Erickson said he has found part-time work as an adviser for “Man, Woman, Wild.” That’s a Discovery Channel program about survival “in some of the most forbidding and remote locations around the world,” its Web site advertises.

Erickson doesn’t fear the possibility of getting back into the flow of the Postal Service after having been away for so long, but he does have other concerns.

“I’m not sure what’s going to happen,” he said. “I’m kind of worried about going back and reprisals. They might fire me the next day. They can fire you, and it takes a long time and a lot of money to fight them.”