Apple has been granted a temporary restraining order against a man it says is harassing CEO Tim Cook.

The filings state that Rakesh Sharma has been harassing Cook and has shown up at his house in Palo Alto, California, twice.

Sharma has now been ordered by a judge to stay away from Cook, his home, and the company's Apple Park headquarters.

Visit Business Insider's homepage for more stories.

Apple has filed a temporary restraining order against a man it says is harassing CEO Tim Cook and other members of Apple's executive team.

The court filings, which were first spotted by OneZero's Dave Gershgorn, allege that a man named Rakesh Sharma has made threats against Apple and Cook, including leaving disturbing voicemails, posting sexual photos on Twitter and tagging Cook, and showing up on the CEO's property in Palo Alto, California, twice. One time, Sharma attempted to deliver flowers and Champagne to Cook, according to testimony by William Burns, Apple's global security specialist, that was included in the court filing.

At one point, the petition says, Sharma stated that he doesn't "use ammunition, but I know people who do," which Apple understood as a threat to use firearms against Cook and the other executives.

The petition, which was filed in Santa Clara County Superior Court, asked for orders of protection for Burns as well as other members of Apple's executive security team. The court granted the petition in part, but only to protect Cook — Sharma has been ordered to stay away from Cook's residence and Apple Park, but the court rejected the motion to bar Sharma from visiting any other Apple retail locations or homes of other Apple executives.

The temporary restraining order will expire March 3, when a hearing is scheduled.

Neither Apple's lawyer nor a company representative immediately responded to Business Insider's request for comment on the restraining order.