Google Inc, which runs the world's most popular Internet search engine, was ordered to defend itself against a lawsuit by a former manager who said he was fired for being too old, clearing the way for a trial.

The California Supreme Court unanimously agreed that a trial court erred in dismissing a complaint by Brian Reid, who was hired in 2002 as a director of operations and engineering, and fired less than two years later at age 54 after being told he was not a good cultural fit.

Thursday's ruling upheld a state appeals court decision that the trial court erred in dismissing the lawsuit, and said the trial court should have considered stray remarks from Reid's colleagues, including that he was an old man and old fuddy-duddy, that might be seen as evidence of bias.

The ruling means the case returns to the trial court.

Brian Reid was not laid off based on his age, said Andrew Pederson, a spokesman for Mountain View, California-based Google, in an emailed statement. We look forward to demonstrating in court the legitimate, nondiscriminatory reasons why Mr. Reid was let go.

Paul Killion, a lawyer for Reid, did not immediately return a call seeking comment.

Reid is a former associate professor of electrical engineering at Stanford University who had helped develop the AltaVista search engine.

He had alleged that while at Google, he was subjected to put-downs by a 38-year-old vice president who told him his ideas were obsolete and too old to matter, and that he was slow, fuzzy, sluggish and lethargic.

The plaintiff also said other colleagues made fun of his age, including a joke that a CD jewel case used as his office placard should instead be an LP, court records show.

The issue for the Supreme Court was whether to apply in California employment bias cases a federal court doctrine under which courts ignore stray remarks by non-decision-making co-workers or by supervisors outside the decisional process.

That term had been coined in a 1989 concurring opinion by U.S. Supreme Court Justice Sandra Day O'Connor.

Writing for the California Supreme Court, Justice Ming Chin said there is much disagreement on how to apply the stray remarks doctrine, and that it is better instead to consider such remarks in the context of other facts in a case.

In this case, he said this included statistical evidence of bias at Google, and changing rationales for Reid's firing after a performance review that said he consistently met expectations.

He said this evidence also included emails between Chief Executive Eric Schmidt and Wayne Rosing, who hired Reid, on a proposal on getting Reid out, as well as an email from Rosing to Google co-founder Sergey Brin about the hunt for a senior Director (note I did not capitalize Sr.) or VP level person to run this operation.

The Court of Appeal properly considered evidence of alleged discriminatory comments made by decision makers and co-workers along with all other evidence in the record, Chin wrote in his 44-page ruling.

The case is Reid v. Google Inc, California Supreme Court, No. S158965.

(Reporting by Jonathan Stempel. Editing by Robert MacMillan, Gary Hill and Tim Dobbyn)