
232 Cal.App.2d 1 (1965)
THE PEOPLE, Plaintiff and Appellant,
v.
ROBERT LOUIS MAGIDSON, Defendant and Respondent.
Crim. No. 4565. 
California Court of Appeals. First Dist., Div. Three.  
Feb. 2, 1965.
 Stanley Mosk, Attorney General, Edward P. O'Brien and John F. Kraetzer, Deputy Attorneys General, for Plaintiff and Appellant.
 George L. Cooke for Defendant and Respondent.
 DRAPER, P. J.
 At preliminary examination, defendant was held to answer three counts of bookmaking (Pen. Code,  337a). The superior court granted his motion to set aside the ensuing information (Pen. Code,  995), and the People appeal.
 A police officer saw one Wood, in an Emeryville bar, dial 861- 6029, and then heard him state names of horses and amounts of money after each horse's name. Investigation revealed that the number dialed was at a San Francisco address, and was listed to a woman known to be defendant's wife. Consultation among police officers of Emeryville, Oakland and San Francisco resulted in a detailed plan which was carried out eight days after the first telephone call. An officer saw Wood dial the telephone in the same bar. He did not see the number, but heard a conversation similar to that previously noted. Wood was then arrested. An officer dialed 861- 6029, a male voice answered "Yeah," and the officer started to recite some bets he desired to make. The telephone at the other end of the line was hung up. The police in Emeryville then radioed to police in San Francisco who were observing the flat from which the telephone was registered. They had seen a male in the flat. The radio message was that a male suspect was in the premises having the suspected telephone. The officers had no warrant for either search or arrest. They went to the door, rang the bell, called out "Police," and started to knock down the door with a sledge hammer. Defendant opened the door before it was broken in, the police entered, and their search revealed bookmaking paraphernalia which was admitted in evidence by the magistrate over objection that it was the product of an illegal search. It is not clear whether the arrest preceded the search. Defendant was held to answer. The superior court reviewed transcript *3 of the preliminary examination and concluded that the evidence seized was the product of an illegal search. Lawfulness of the arrest is conceded, but the court held that the search could not be justified as incident to it, because in fact the search was the primary objective and the arrest, the incident.
 [1] An arrest may not be used as a pretext to search for evidence, and when it is "at most an incident of the search" the search is unwarranted (People v. Haven, 59 Cal.2d 713, 720 [31 Cal.Rptr. 47, 381 P.2d 927]).
 [2] But whether the search was the primary objective or a mere incident necessarily turns upon the facts and particularly upon the inferences to be drawn from the facts established. Necessarily, such subjective elements as intent and purpose are matters of inference, and thus issues of fact.
 [3] On a motion to set aside an information (Pen. Code,  995) the trial court may not reweigh the evidence or draw inferences contrary to those reasonably drawn by the committing magistrate (People v. Malki, 181 Cal.App.2d 118, 122 [5 Cal.Rptr. 207]). The same limitation applies when the issue is legality of search or seizure (Badillo v. Superior Court, 46 Cal.2d 269, 271-272 [294 P.2d 23]; People v. Soto, 144 Cal.App.2d 294, 296-297 [301 P.2d 45]).
 [4] Here contrary inferences may be drawn as to whether the search or the arrest was the incident. The magistrate resolved this issue adversely to defendant. Upon the motion to set aside, his conclusion must prevail over that of the superior judge, who but reviewed the transcript of the preliminary examination.
 Order reversed.
 Salsman, J., and Devine, J., concurred.
