Dead to Rights

DEAD TO RIGHTS---Without possibility of error; red handed.---"We've got him dead to rights."---The San Francisco newspaper City Argus. news story: "A man attempted to get into Banker Sather's cash box and was caught 'dead to rights' and now languishes in the city Bastille."

Sounds legal but I am not sure of the exact origin.