This paper explores the use of random forests for variable selection, focusing on two classical issues: finding important variables for interpretation and designing a good prediction model. The main contributions are twofold: providing insights into the behavior of the variable importance index based on random forests and proposing a strategy involving a ranking of explanatory variables using the random forests score of importance and a stepwise ascending variable introduction strategy. The paper discusses the sensitivity of the variable importance index to sample size, number of variables, method parameters, and highly correlated predictors. It also presents a two-step procedure for variable selection, which is applied to high-dimensional classification datasets and a standard regression dataset to demonstrate its effectiveness. The results show that the proposed method can effectively select a small number of important variables for both interpretation and prediction, even in the presence of highly correlated variables.This paper explores the use of random forests for variable selection, focusing on two classical issues: finding important variables for interpretation and designing a good prediction model. The main contributions are twofold: providing insights into the behavior of the variable importance index based on random forests and proposing a strategy involving a ranking of explanatory variables using the random forests score of importance and a stepwise ascending variable introduction strategy. The paper discusses the sensitivity of the variable importance index to sample size, number of variables, method parameters, and highly correlated predictors. It also presents a two-step procedure for variable selection, which is applied to high-dimensional classification datasets and a standard regression dataset to demonstrate its effectiveness. The results show that the proposed method can effectively select a small number of important variables for both interpretation and prediction, even in the presence of highly correlated variables.