You have to feel for Samsung, it’s had a pretty rough week. First, it lost a high-profile patent suit to Apple which will cost it in upwards of $1 billion. And now it’s facing a US sales ban on 8 devices.

But this should help ease the pain: a Tokyo judge has just handed Samsung a court victory, ruling that its phones and tablets do not violate Apple’s patent related to music and video syncing…

Reuters reports:

“A Tokyo court ruled on Friday that Samsung Electronic’s mobile devices did not violate an Apple Inc patent, awarding the South Korean firm a victory a week after it lost a landmark patent case in the United States.”

The patent in question has to do with Apple’s technology it uses for syncing media content between iOS, and other devices. And it obviously felt that Samsung stole the idea, but the court didn’t.

In addition to the no-infringement ruling, Apple has also been ordered by Tokyo District Judge Tamotsu Shoji to pay all lawyer fees and other costs related to the lawsuit it filed late last year.

AllThingsD has a statement from Samsung:

“We welcome the court’s decision, which confirmed our long-held position that our products do not infringe Apple’s intellectual property. We will continue to offer highly innovative products to consumers, and continue our contributions towards the mobile industry’s development.”

While this is undoubtedly a sweet victory for the South Korean company, don’t expect it to rest on its laurels. Samsung is said to be working on a major legal counterattack against Apple, and plans to sue the iPad-maker as soon as it releases its next-gen iPhone over LTE patents.