WASHINGTON — Some critics of President Trump have accused him of obstruction of justice in his firing of the F.B.I. director, James B. Comey, amid the bureau’s investigation into the Trump campaign’s contacts with Russia. Here is a look at the complex legal concept.

What is obstruction of justice?

Several federal statutes criminalize actions that impede official investigations. While some examples of illegal ways to thwart the justice system are specific — like killing a witness or destroying evidence — the law also includes broad, catchall prohibitions. For example, Section 1512 of Title 18 makes it a crime if someone corruptly “obstructs, influences or impedes any official proceeding,” even if the proceeding was not yet pending at the time of the act. A conviction under that provision can be punished by up to 20 years in prison.

Could that cover firing the F.B.I. director?

In theory. Samuel Buell, a former federal prosecutor who now teaches criminal law at Duke University, said statutes like Section 1512 were “drafted broadly to cover all possible means of obstruction of justice,” because there are so many ways to thwart the legal system. So in theory, he said, firing an investigator could fit. But there would be significant practical obstacles to bringing such a case.

Did Mr. Trump have lawful authority to fire Mr. Comey?

Yes. But courts have ruled that otherwise lawful acts can constitute obstruction of justice if done with corrupt intentions. Mr. Buell pointed to a 1998 case in which a federal appeals court upheld the conviction of a lawyer who had filed legal complaints and related motions against a government agent who was investigating an illegal gambling operation. The court ruled that the defendant’s “nominally litigation-related conduct” was unlawful because his real motive was “to safeguard his personal financial interest” in the corrupt enterprise.