The decision by FBI Director James Comey to announce a new probe of Hillary Clinton’s emails just days before the election is under enormous political fire. But as a leading privacy scholar notes, Comey’s move also raises doubts about whether the investigation is legal under the Fourth Amendment, which protects Americans from unreasonable search and seizure.

The privacy issue has emerged because the FBI did not come across the emails in the course of a Clinton investigation, but from an unrelated probe into the underage sexting activities of disgraced former Congressman Anthony Weiner. (One tabloid has since dubbed the matter “Dickileaks.”) In searching his laptop, the FBI says it found 650,000 emails belong to Huma Abedin, who is Weiner’s ex-wife and a long-time Clinton aide.

The problem, from a legal point of view, is that a search warrant isn’t supposed to let law enforcement get access to everything on a computer. Instead, in this case, the FBI should only have been able to retrieve information related to Weiner’s sexting activities. The other evidence should have been off-limits unless a court had given the FBI permission to look for it. It’s as if the police had a warrant to search Weiner’s closet, but then decided to snoop around his bedroom as well.

Yes, the FBI has since gotten a separate warrant to search the Abedin emails, but that doesn’t change the fact the agency likely had no right to come across them in the first place.

As law professor Orin Kerr explained in a widely-read Washington Post article, the so-called “plain view exception”—which can let police seize evidence without a warrant—doesn’t appear to apply in this situation. Kerr’s piece is worth reading in full, but here’s a key paragraph from his argument (my emphasis):

The Fourth Amendment plain view standard doesn’t allow a seizure of emails based on a mere we-hope-to-later-determine standard. The government can’t seize the emails just because the Clinton investigation is extra important and any possible evidence is worth considering. Rather, the Fourth Amendment requires the initial look at the emails to generate “immediate” probable cause that they are evidence of a crime first, before their seizure is permitted and used to get a second warrant.

In other words, even if the FBI did find something incriminating about Clinton in Abedin’s emails, a judge would have to suppress the evidence because it would amount to what legal scholars call “fruit of the poisonous tree.” (As Kerr notes, it would be up to Abedin to make such a request as it is her privacy rights at stake).

Sign up for Data Sheet, Fortune’s technology newsletter.

Of course, these sort of arguments are unlikely to change many opinions in a hyper-partisan election environment, when many people have made up their mind about Clinton and her emails already. But given the intense controversy surrounding Comey and the FBI’s handling of the email investigation thus far, the apparent Fourth Amendment argument would likely amount to another black eye for the agency.

As it stands, the FBI says it is using special software to analyze the Abedin emails, and that the agency will not complete the process until after election day. To get a more detailed account of the latest Comey controversy, see my Fortune colleague Roger Parloff’s helpful “A Non-Partisan Explanation of FBI Director James Comey’s Clinton Email Decision.”