The judge was intrigued.

Before her in a hearing room on Staten Island sat Cristy Matteo, the owner of a pet pig named Wilbur. She was accused of illegally harboring a wild animal.

The judge said that she knew of only one other pig that had been through the system, Ms. Matteo recalled. The judge named the pig. Ms. Matteo immediately named the pig’s owner.

“The judge was smiling at me,” Ms. Matteo said. The judge asked if there was an underground pig network in New York. “I said, ‘More than you can imagine.’”

An untold number of pet pigs are scattered throughout the city, despite a ban. They can be found in all five boroughs, the veterinarians who treat them say. “There are so, so many of us,” said a neighbor of Ms. Matteo’s who has two pigs and gave her name only as Leslie W. Ms. Matteo said she knew of dozens.