Is it moral to behave only in terms of fearing punishment? For example, suppose

Read another response by Thomas Pogge
Read another response about Ethics, Punishment
Is it moral to behave only in terms of fearing punishment? For example, suppose the only reason a person has for not behaving immorally is the fear of divine punishment. Since his actions yield the same results as another non-immoral person who has no fear of divine punishment, why does it matter what reasons give the same results?