As unfair as this may seen, yes it is legal. The fact is that an employer may hire/fire at will. Additionally, it may discharge an employee for this reason or no reason at all. So unless your termination constitued some form of actionable discrimination or violated the terms of company policy or an employment/union contract, its actions were perfectly permissible.That having been said, you may possibly have legal recourse based on something in the law known as "detrimental reliance". For example, if you turned down another job or quit a job based on your employer's credible promise of steady employment even after you informed it of your experience level then may be able to hold the employer liable, However, this is not at all clear that you have such a claim based on the limited facts presented. Consequently, if you think that you can make a case for detrimental reliance, you may want to consult directly with an employment law attorney in your area and see if you have a claim worth pursuing.