
93 Cal.Rptr.2d 425 (2000)
78 Cal.App.4th 1096
Russell JACOBUS, Plaintiff and Appellant,
v.
KRAMBO CORPORATION, Defendant and Respondent.
No. A087995.
Court of Appeal, First District, Division Five.
March 3, 2000.
*427 Kyra A. Subbotin, Counsel for Plaintiff and Appellant.
Folger, Levin & Kahn, Peter M. Folger, Margaret E. Murray, Theresa I. McFarland, San Francisco, Counsel for Defendant and Respondent.
*426 HANING, J.
The question before us is whether an employee who is sued by a coworker for sexual harassment is entitled under Labor Code section 2802 to indemnification from his employer of the legal costs incurred successfully defending the sexual harassment action. We conclude that he is, and we reverse the summary judgment in favor of the employer.

BACKGROUND

The Claim for Indemnification
Plaintiff Russell Jacobus was employed by Krambo Corporation, a six-person investment banking firm, and served as the company's treasurer and chief financial officer. In 1995 Jacobus and Krambo were sued for sexual harassment by Rosie Vera-Aviles, a secretary at the firm. Vera-Aviles alleged that Jacobus had created a hostile work environment through his unwelcome sexual communications and touching.
Jacobus asked Krambo to defend him in the action, but Krambo refused, and Krambo eventually settled with Vera-Aviles. Jacobus proceeded to trial alone and the jury found in his favor that no sexual harassment had occurred. Jacobus incurred $82,083 in attorney fees and costs in successfully defending that action, and Krambo refused to reimburse Jacobus for his expenses. Jacobus then filed the present lawsuit against Krambo for indemnification *428 pursuant to Labor Code section 2802.[1]
Jacobus and Krambo each moved for summary judgment, contending that the underlying facts were undisputed and that Krambo's liability for indemnification was a question of law. The trial court granted Krambo's motion and entered judgment in its favor. Jacobus appeals.

The Sexual Harassment Claim
Jacobus and Vera-Aviles had a friendly relationship in the office, which was marked by frequent sexual bantering. They discussed their personal lives with each other, including their sexual encounters. Vera-Aviles also had frequent conversations with other workers in the office involving sexual matters.
Jacobus and Vera-Aviles also socialized outside of work: i.e., they played softball, they had dinner together, and they played pool. Vera-Aviles frequently would jokingly invite Jacobus to take her to a strip club, and she occasionally rubbed Jacobus's shoulders at work as a friendly, nonsexual gesture.
During his employment with Krambo, Jacobus stored in his office drawer some erotic stories written with his sister-in-law. Vera-Aviles asked to see the stories, and Jacobus acquiesced. In April or May 1995, Jacobus received two faxes at work from his sister-in-law containing sexual materials, and he shared them with Vera-Aviles. In May or June 1995 Jacobus composed a sexually explicit five-paragraph story on his office computer, which he also shared with Vera-Aviles at her request. He and Vera-Aviles passed the story back and forth with handwritten post-it notes attached. A few days later, Jacobus composed another erotic story and gave it to Vera-Aviles.
One day Jacobus and Vera-Aviles played a computer golf game. When Vera-Aviles asked Jacobus to play again, he wrote her a note suggesting a "strip poker" version, and he put his hand on her thigh at one point during the game.
Jacobus was not Vera-Aviles's supervisor, although he commonly reviewed her work. In mid-July 1995 Jacobus conveyed a coworker's complaint about Vera-Aviles to Krambo's vice-president, Stephen Young. Young and Jacobus met with Vera-Aviles to discuss the complaint that she was spending too much time on the phone. Vera-Aviles became upset that her job performance was being criticized.
Later that day, Vera-Aviles met privately with Young and showed him some of Jacobus's sexually explicit notes. She asserted for the first time that Jacobus had sexually harassed her and complained that the meeting with Jacobus and Young had been a continuation of the harassment. Young and the company's president, Douglas Kramlich, met with Jacobus, and Young suggested that Jacobus should accelerate his already-formed plan to leave the firm. Jacobus resigned that day.
Four days later, Vera-Aviles quit her job at Krambo, and subsequently she filed her a sexual harassment action against Jacobus and Krambo.

DISCUSSION
Section 2802 requires an employer to indemnify an employee for all expenses and losses incurred "in direct consequence of the discharge of his duties." The statute requires the employer not only to pay any judgment entered against the employee for conduct arising out of his employment but also to defend an employee who is sued for such conduct. Unlike an insurer, the employer need not defend *429 whenever there is a mere potential for liability. However, if the employer elects to run a risk and refuses to defend, the employer must indemnify the employee for his attorney fees and costs in defending the underlying action if the employee was sued for acts within the scope of his employment. (Douglas v. Los Angeles Herald-Examiner (1975) 50 Cal.App.3d 449, 457-465, 123 Cal.Rptr. 683 (Douglas).)
Both Jacobus and Krambo mistakenly assert that indemnification under section 2802 is required only if the underlying action was unfounded, citing Douglas, supra, 50 Cal.App.3d at pages 461-462, 465, 123 Cal.Rptr. 683. (See also Devereaux v. Latham & Watkins (1995) 32 Cal. App.4th 1571, 1583, 38 Cal.Rptr.2d 849 (Devereaux); Los Angeles Police Protective League v. City of Los Angeles (1994) 27 Cal.App.4th 168, 177, 32 Cal.Rptr.2d 574.) Both parties seem to accept that because the jury found Jacobus not liable for sexual harassment, the underlying action was unfounded.
Yet, section 2802 imposes no such requirement, and the Douglas opinion refers to a requirement mentioned in the Restatement Second of Agency. (Douglas, supra, 50 Cal.App.3d at p. 461, 123 Cal. Rptr. 683.) In Douglas, the merits of the underlying action came into play only because the lawsuit did not culminate in a judgment. It was settled with a dismissal, in exchange for the employee's agreement to give a deposition for the plaintiff and waive the news reporter's privilege. The question before the Douglas court was whether the employer has a duty to indemnify when the underlying lawsuit is successfully defended, and the court held that the employer has a duty to pay the defense costs when the employee prevails. Nothing in the court's analysis suggests that an employer's duty to indemnify arises only if the underlying charges are unfounded. The Douglas court expressly rejected the notion that the underlying lawsuit must have been brought by the third party in good faith. (Id. at p. 462, 123 Cal.Rptr. 683.)
The test for recovery under section 2802 is whether the conduct defended against was within the course and scope of employment. (Douglas, supra, 50 Cal.App.3d at pp. 463-465, 123 Cal.Rptr. 683.) In determining whether for purposes of indemnification an employee's acts were performed within the course and scope of employment, the courts have looked to the doctrine of respondeat superior. (E.g., Devereaux, supra, 32 Cal.App.4th at p. 1583, 38 Cal.Rptr.2d 849 [indemnification under § 2802]; see Farmers Ins. Group v. County of Santa Clara (1995) 11 Cal.4th 992, 1003, 47 Cal.Rptr.2d 478, 906 P.2d 440 (Farmers Ins. Group) [defense and indemnity of public employees under Tort Claims Act (Gov.Code, §§ 825, 995) ].)
Under that doctrine, an employer is vicariously liable for risks broadly incidental to the enterprise undertaken by the employerthat is, for an employee's conduct that, in the context of the employer's enterprise, is "not so unusual or startling that it would seem unfair to include the loss resulting from it among other costs of the employer's business. [Citations.]" (Rodgers v. Kemper Constr. Co. (1975) 50 Cal.App.3d 608, 619, 124 Cal. Rptr. 143; accord Mary M. v. City of Los Angeles (1991) 54 Cal.3d 202, 209, 285 Cal. Rptr. 99, 814 P.2d 1341 (Mary M.); Perez v. Van Groningen & Sons, Inc. (1986) 41 Cal.3d 962, 968, 227 Cal.Rptr. 106, 719 P.2d 676.) An employer is not vicariously liable for an employee's conduct if the employee substantially deviates from his or her course of duty so as to amount to a complete departure. (Farmers Ins. Group, supra, 11 Cal.4th at p. 1005, 47 Cal.Rptr.2d 478, 906 P.2d 440; DeMirjian v. Ideal Heating Corp. (1954) 129 Cal. App.2d 758, 766, 278 P.2d 114 (DeMirjian).) However, acts that are necessary to the comfort, convenience, health, and welfare of the employee while at work, though personal and not acts of service, do not take the employee outside the scope of his *430 employment. (Alma W. v. Oakland Unified School Dist. (1981) 123 Cal.App.3d 133, 139, 176 Cal.Rptr. 287 (Alma W.); DeMirjian, supra, 129 Cal.App.2d at p. 765, 278 P.2d 114.) Moreover, an employee's conduct may fall within the scope of his employment even though the act does not benefit the employer, even though the act is willful or malicious, and even though the act may violate the employer's direct orders or policies. (Mary M., supra, at p. 209, 285 Cal.Rptr. 99, 814 P.2d 1341.)
The cases have consistently held that under the doctrine of respondeat superior, sexual misconduct falls outside the course and scope of employment. (Lisa M. v. Henry Mayo Newhall Memorial Hospital (1995) 12 Cal.4th 291, 48 Cal.Rptr.2d 510, 907 P.2d 358 [hospital not liable for sexual battery on patient by technician]; Jeffrey E. v. Central Baptist Church (1988) 197 Cal.App.3d 718, 722, 243 Cal.Rptr. 128 [church not liable for child molesting by Sunday school teacher]; Alma W., supra, 123 Cal.App.3d at pp. 140-142, 176 Cal. Rptr. 287 [school district not liable for rape of student by janitor].) In line with that authority, the California Supreme Court has held that an employer has no obligation to indemnify a sexual harasser, even though the acts occurred during work hours on the employer's premises. (Farmers Ins. Group, supra, 11 Cal.4th 992, 47 Cal.Rptr.2d 478, 906 P.2d 440.)
In Farmers Ins. Group the court reasoned that the harassing conduct of the employee, a deputy sheriff, was personal in nature and did not arise out of the employment: "[The employee's] repeated requests for sexual favors and his inappropriate touchings were motivated for strictly personal reasons unrelated to the guarding of inmates or the performance of any other duty of a deputy sheriff at a county jail. Furthermore, [the employee's] misconduct was not reasonably necessary to his comfort, convenience, health, and welfare while at work. Nor was it precipitated by a work-related dispute over the performance of his duties or those of his victims. Indeed, [the employee's] actions were in direct violation of the County's policy prohibiting sexual harassment in the workplace...." (11 Cal.4th at p. 1007, 47 Cal.Rptr.2d 478, 906 P.2d 440.)
In contrast to Farmers Ins. Group and the cases of sexual misconduct upon which it relies, Jacobus's conduct was determined in the underlying action not to amount to sexual harassment. Nevertheless, the acts committed by Jacobus were not disputed. In the underlying lawsuit by Vera-Aviles, Jacobus conceded he discussed his sex life" with her, engaged in sexual bantering with her, and showed her sexually explicit materials. His defense was that Vera-Aviles consented to these exchanges and therefore that his acts did not constitute sexual harassment. The jury agreed and found in Jacobus's favor. The question before us, then, is whether the acts for which Jacobus was suedacts not amounting to sexual harassmentfell within the scope of his employment.
The question whether an employee's acts are within the scope of employment is ordinarily a question of fact, but the issue may be determined as a question of law when the material facts are undisputed and no conflicting inferences are possible. (Mary M., supra, 54 Cal.3d at p. 213, 285 Cal.Rptr. 99, 814 P.2d 1341.) In the present case, the parties do not dispute the predicate facts, and both parties agree that the issue is one of law.
In support of the trial court's ruling, Krambo relies primarily upon the line of cases holding that sexual harassment is conduct outside the scope of employment. Krambo maintains that, like the offending conduct of the deputy sheriff in Farmers Ins. Group, the interactions between Jacobus and Vera-Aviles were motivated by Jacobus's own desire for sexual gratification. Krambo emphasizes that the written materials Jacobus exchanged with Vera-Aviles were sexually explicit, and Krambo insists that Jacobus's display of the sexual *431 materials to Vera-Aviles was personal in nature, unrelated to the performance of his duties as chief financial officer and treasurer of the company, even though it occurred at the workplace during working hours.
We are not convinced. Krambo fails to acknowledge that in light of the verdict in the underlying action, Jacobus's conduct must necessarily be viewed as something other than sexual misconduct or sexual harassment. The jury in the underlying action answered "No" to the first question on the special verdict form: "Did the Defendant Russell Jacobus unlawfully subject plaintiff Rosie Vera-Aviles to unwelcome sexual harassment which was sufficiently severe or pervasive to alter the conditions of her employment and to create a hostile or abusive work environment?" In light of this verdict and what appears to be the entirely consensual interchange between Jacobus and Vera-Aviles, we conclude that the conduct of Jacobus was simply part of the social intercourse that occasionally occurs in modern office settings.
As Jacobus persuasively argues, social interactions among employees, including sharing of private or personal information, are broadly incidental to the enterprise of an employer. In Carr v. Wm. C. Crowell Co. (1946) 28 Cal.2d 652, 656, 171 P.2d 5 (Carr) the court reasoned that one risk inherent in employment is the risk that the association of coworkers will "create[] occasions for lapses into carelessness and for fun-making and emotional flare-up.... These expressions of human nature are incidents inseparable from working together. They involve risks of injury, and these risks are inherent in the working environment. [Citations.]"
The undisputed facts in this case indicate that within the context of the small Krambo office setting and the friendly working relationship between Jacobus and Vera-Aviles, sexual joking and profanity were commonplace. Moreover, Krambo is now collaterally estopped to deny that Vera-Aviles consented to the exchanges. We conclude that Jacobus's consensual sharing of sexual materials with Vera-Aviles was no more unusual or startling than other forms of everyday conversation among coworkers.
Furthermore, Vera-Aviles made her charges of sexual harassment to Young within hours after Jacobus and Young met with her to discuss her job performance. Until that performance review, Vera-Aviles had never complained to Jacobus or to anyone else that Jacobus's sexual exchanges were unwelcome. The facts suggest that Vera-Aviles developed her sexual harassment claim to gain an advantage in her employment. In our view, the risk that one worker may accuse another of sexual harassment to deflect an adverse performance review is a risk inherent in employment, analogous to the risk recognized in Carr, supra, 28 Cal.2d 652, 171 P.2d 5, that one worker may assault another in a job-related dispute. If the employer chooses not to defend the accused employee in the lawsuit, then the employer must pay the defense costs of the exonerated employee.
In summary, we hold that in light of all the circumstances, the mutual exchange of sexual materials between Jacobus and Vera-Aviles was broadly incidental to their employment and Jacobus was entitled to indemnification of his legal costs incurred in successfully defending Vera-Aviles's sexual harassment action. The trial court should have granted the summary judgment motion brought by Jacobus.
On remand, it will be for the trial court to decide the amount Jacobus may recover. Whether the legal expenses incurred by an employee were necessary requires an inquiry into reasonableness and is a question of fact. (Grissom v. Vons Companies, Inc. (1991) 1 Cal.App.4th 52, 58, 1 Cal.Rptr.2d 808.) The parties have raised on appeal the question not yet reached by the trial courtwhether Jacobus is entitled to his attorney fees incurred *432 in bringing the present action for indemnification. For guidance of the trial court, we set out our views.
Section 2802 requires the employer to indemnify the employee for "all that the employee necessarily expends or loses in direct consequence of the discharge of his duties...." No California court has yet decided the precise question whether "all that the employee necessarily expends" includes attorney fees incurred in enforcing the right of indemnification. (Douglas, supra, 50 Cal.App.3d at pp. 467-469, 123 Cal.Rptr. 683 [declining to decide].) However, cases arising in an analogous context are instructive.
In Otis Elevator Co. v. Toda Construction (1994) 27 Cal.App.4th 559, 564, 32 Cal.Rptr.2d 404 (Otis Elevator Co.), the court held that an indemnification agreement providing indemnity for "all liability, ... losses, damages, expenses, ... awards and judgements (including reasonable attorney's fees)" incidental to the performance of the construction contract did not include attorney fees incurred within the action to enforce the indemnity provision of the contract. The court relied upon the general rule that attorney fees are not recoverable unless provided for by statute or by contract. (Code Civ. Proc., § 1021.)
Otis Elevator Co. noted that Civil Code section 2778 (governing indemnity contracts) had been construed by the Ninth Circuit Court of Appeals in DeWitt v. Western Pacific R. Co. (9th Cir.1983) 719 F.2d 1448 (DeWitt) to extend indemnification benefits to include attorneys fees incurred in prosecuting an indemnification claim. However, the California appellate courts have not followed DeWitt and have concluded that unless an indemnity agreement specifically provides for attorney fees incurred in pursuing the indemnity claim, the indemnitee is not entitled to such fees. (Otis Elevator Co., supra, 27 Cal.App.4th at pp. 565-566, 32 Cal.Rptr.2d 404, and cases cited therein.)
Similarly, under Code of Civil Procedure section 1021.6 (attorney fees for implied indemnity), the courts have held that although the indemnitee is entitled to attorney fees in the underlying action, fees incurred in bringing the indemnification action itself are not recoverable. (Bear Creek Planning Com. v. Title Ins. & Trust Co. (1985) 164 Cal.App.3d 1227, 1245-1246, 211 Cal.Rptr. 172 (Bear Creek Planning Com.), disapproved on another point in Bay Development Ltd. v. Superior Court (1990) 50 Cal.3d 1012, 1032, fn. 12, 269 Cal.Rptr. 720, 791 P.2d 290.) "In the indemnity action, however, the plaintiff occupies no different position than any other plaintiff seeking to recover damages proximately caused by the defendant. As to attorney fees in the present action, plaintiff ... is subject to the general rule of [Code of Civil Procedure] section 1021 that the parties bear their own fees except as provided by specific statute or express or implied agreement." (Bear Creek Planning Com., supra, at p. 1246, 211 Cal.Rptr. 172.)
Here, while section 2802 unquestionably provides for indemnification of attorney fees incurred in the underlying action, the statute does not specifically provide for attorney fees incurred in pursuing the indemnity claim. By analogy to the case law recited above, we conclude that Jacobus's entitlement to recovery of his attorney fees in bringing the present action is governed by the general rule that attorney fees are not recoverable.
We acknowledge that the Ninth Circuit has recently construed section 2802 to include attorney fees incurred in enforcing a claim under that statute, reasoning as follows: "[I]f fees incurred in enforcing indemnity claims were excluded, the right to claim fees incurred in the original action would be effectively eliminated. An employer who wished to avoid paying an employee who had proven a right to indemnification under [section] 2802 could simply refusesecure in the knowledge that it might very well cost the employee more to enforce his rights under [section] 2802 than the amount expended in the original action." (O'Hara v. Teamsters Union Local *433 856 (9th Cir.1998) 151 F.3d 1152, 1161 (O'Hara).)
However, we are not persuaded by that analysis. In light of the established principle that a prevailing party is not entitled to recover attorney fees in the absence of a specific contract or statute (Code Civ. Proc., § 1021), we must be guided by the language of Labor Code section 2802. We decline to read into the statutory phrase "all that the employee necessarily expends or loses in direct consequence of the discharge of his duties as such," a specific provision allowing recovery of attorney fees to enforce its indemnification provisions. Contrary to the reasoning in O'Hara, we think that the employer's own attorney fees incurred in resisting indemnification are a sufficient deterrent to keep most employers from wrongfully refusing to pay a claim under section 2802.

DISPOSITION
The judgment is reversed, and the trial court is directed to grant appellant's motion for summary judgment. Costs are awarded to appellant.
JONES, P.J., and STEVENS, J., concur.
NOTES
[1]  Labor Code section 2802 provides: "An employer shall indemnify his employee for all that the employee necessarily expends or loses in direct consequence of the discharge of his duties as such, or of his obedience to the directions of the employer, even though unlawful, unless the employee, at the time of obeying such directions, believed them to be unlawful."

All further section references are to the Labor Code unless otherwise indicated.
