A photographer suspected of planting a listening device outside the Sydney home of Oscar-winning actress Nicole Kidman (search) will not have to give a DNA sample to police, an appeals court ruled Tuesday.

One of Kidman's security guards spotted the device near a sidewalk outside her lavish harborfront mansion in January.

Police later alleged that celebrity photographer Jamie Fawcett (search), 43, had been captured on security footage near the house around the time the bug was planted.

The Waverley Local Court in April ordered Fawcett to supply police with a DNA sample to be compared with samples allegedly found on the listening device.

But Fawcett appealed the ruling to the New South Wales state Supreme Court, which held Tuesday that he could not be forced to provide police with a DNA sample since there was no evidence he had violated any law.

"There was no evidence before the court that the device was ever used or caused to be used to record or listen to a conversation," Judge Michael Grove said in his judgment.

He also ordered Detective Malcolm Nimmo, who brought the matter to court, to pay Fawcett's legal costs.

Outside the court, Fawcett said he was relieved the case was over.

"I'm really happy commonsense has prevailed," he told reporters. "I thought that for a long while this has just gone on and on and I'm really glad it's over."

Earlier this year, Kidman reached an out of court settlement with Fawcett and fellow Sydney-based photographer Ben McDonald, 32, after she was granted a temporary restraining order against the pair for allegedly stalking her and making her feel like a prisoner in her own home.

Kidman won a best-actress Oscar for her role in 2002's "The Hours."