A doctor in New York City who recently returned from treating Ebola patients in Guinea became the first person in the city to test positive for the virus Thursday, setting off a search for anyone who might have come into contact with him.

The doctor, Craig Spencer, was rushed to Bellevue Hospital Center and placed in isolation at the same time as investigators sought to retrace every step he had taken over the past several days.

At least three people he had contact with in recent days have been placed in isolation. The federal Centers for Disease Control and Prevention, which dispatched a team to New York, is conducting its own test to confirm the positive test on Thursday, which was performed by a city lab.

While officials have said they expected isolated cases of the disease to arrive in New York eventually, and had been preparing for this moment for months, the first case highlighted the challenges involved in containing the virus, especially in a crowded metropolis. Dr. Spencer, 33, had traveled on the A and L subway lines Wednesday night, visited a bowling alley in Williamsburg, and then took a taxi back to Manhattan.