We developed a biologically detailed multiscale model of mouse primary motor cortex (M1) microcircuits, incorporating data from several recent experimental studies. The model simulates at scale a cylindrical volume with a diameter of 300 m and cortical depth 1350 m of M1. It includes over 10,000 cells distributed across cortical layers based on measured cell densities, with close to 30 million synaptic connections. Neuron models were optimized to reproduce electrophysiological properties of major classes of M1 neurons. Layer 5 corticospinal and corticostriatal neuron morphologies with 700+ compartments reproduced cell 3D reconstructions, and their ionic channel distributions were optimized within experimental constraints to reproduce in vitro recordings. The network was driven by the main long-range inputs to M1: posterior nucleus (PO) and ventrolateral (VL) thalamus PO, primary and secondary somatosensory cortices (S1, S2), contralateral M1, secondary motor cortex (M2), and orbital cortex (OC). The network local and long-range connections depended on pre-and post-synaptic cell class and cortical depth. Data was based on optogenetic circuit mapping studies which determined that connection strengths vary within layer as a function of the neuron's cortical depth. The synaptic input distribution across cell dendritic trees -likely to subserve important neural coding functions -was also mapped using optogenetic methods and incorporated into the model. We employed the model to study the effect on M1 of increased activity from each of the long-range inputs, and of different levels of H-current in pyramidal tract-projecting (PT) corticospinal neurons. Microcircuit dynamics and information flow were quantified using firing rates, oscillations, and information transfer measures (Spectral Granger causality). We evaluated the response to short pulses and long time-varying activity arising from the different long-range inputs. We also studied the interaction between two simultaneous long-range inputs. Simulation results support the hypothesis that M1 operates along a continuum of modes characterized by the degree of activation of intratelencephalic (IT), corticothalamic (CT) and PT neurons. The particular subset of M1 neurons targeted by different long-range inputs and the level of H-current in PT neurons regulated the different modes. Downregulation of H-current facilitated synaptic integration of inputs and increased PT output activity. Therefore, VL, cM1 and M2 inputs with downregulated H-current promoted an PT-predominant mode; whereas PO, S11 . CC-BY-NC-ND 4.0 International license It is made available under a (which was not peer-reviewed) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity.The copyright holder for this preprint . http://dx.doi.org/10.1101/201707 doi: bioRxiv preprint first posted online Oct. 11, 2017; and S2 inputs with upregulated H-current favored an IT-predominant mode, but a mixed mode where upper layer IT cells in turn activated PT cells if H-c...