We have studied the mechanism of contour perception by recording from neurons in the visual cortex of alert rhesus monkeys. In order to assess the relationship between neural signals and perception, we compared the responses to edges and lines with the responses to patterns in which human observers perceive a contour where no line or edge is given (anomalous contour), such as the border between gratings of thin lines offset by half a cycle. With only one exception out of 60, orientation-selective neurons in area V1 did not signal the anomalous contour. Many neurons failed to respond to this stimulus at all, others responded according to the orientation of the grating lines. In area V2, 45 of 103 neurons (44%) signaled the orientation of the anomalous contour. Sixteen did so without signaling the orientation of the inducing lines. Some responded better to anomalous contours than to the optimum bars or edges. Preferred orientations and widths of tuning for anomalous contour and bar or edge were found to be highly correlated, but not identical, in each neuron. Similar to perception, the neuronal responses depended on a minimum number of lines inducing the contour, but not so much on line spacing, and tended to be weaker when the lines were oblique rather than orthogonal to the border. With oblique lines, the orientations signaled were biased towards the orientation orthogonal to the lines, as in the Zollner illusion. We conclude that contours may be defined first at the level of V2. While the unresponsiveness of neurons in V1 to this type of anomalous contour is in agreement with linear filter predictions, the responses of V2 neurons need to be explained. We assume that they sum the signals of 2 parallel paths, one that defines edges and lines and another that defines anomalous contours by pooling signals from end-stopped receptive fields oriented mainly orthogonal to the contour.