We describe an algorithm to determine
whether a matrix group over a finite field, generated by a given set of matrices, contains one of the classical
groups or the special linear group. The algorithm is based on finding elements with certain properties by
independent random selection from the group. Very few matrix groups other than the classical groups contain
subsets of elements with the required properties, and a classification of such matrix groups is the principal
theoretical basis of the algorithm. The classification, which is proved here, builds on work of Guralnick,
Penttila, Saxl and the second author, and depends on the finite simple group classification. Moreover,
probability estimates for finding such elements in classical groups are derived, and these are used to give
a theoretical analysis of the performance of the algorithm. The algorithm has been implemented in the computer
systems {\sf GAP} and{\scMagma}.
1991 Mathematics Subject Classification: primary 20G40, 11E57, 20-04,
60B99; secondary 15A30.