Imagine Seth Horvitz’s surprise: He ordered a TV set online last week. But he didn’t get what he paid for.

Instead of delivering a 39-inch Westinghouse, a UPS driver Monday night left a box outside Horvitz’s apartment that contained a military-style seminautomatic rifle — a SIG716, resembling the M-16 carried by U.S. soldiers for decades.

Horvitz, 38, who composes and performs electronic music, had never held a gun of any kind before he opened the box in the kitchen of his apartment in the Brookland neighborhood of Northeast Washington. He said he knew that the box was too small for a TV, but thought the seller might have sent him a TV stand to go with it.

Then he got a closer look at the box’s contents, and was aghast, he said.

“I was confused as to how that kind of mixup could happen,” said Horvitz, who ordered the TV from a third party through Amazon. “It suprised me to see how easy it would be for a gun to show up on someone’s doorstep — not just a gun, but an assault weapon.”

He said there were two UPS mailing labels on the box. One had his name and address, apparently affixed to the parcel by mistake. The other label bore the name and address of a gun store in Pennsylvania, which had ordered the rifle from a supplier.

Horvitz called D.C. police, who took custody of the weapon. As for the flat-screen TV, it hasn’t arrived yet, he said.

This item has been updated.