Under Gov. Code 12965(b), (c)(6), the award of attorney fees and costs to a prevailing defendant in a FEHA case is discretionary but governed by the rule that the defendant may recover fees and costs only when the claim was frivolous.  This decision holds that since the trial court must exercise its discretion, the prevailing defendant cannot claim costs by simply filing a memorandum of costs, but must file a motion to be deemed entitled to costs, just as it would have to move for a court order for an award of attorney fees.