Determining the optimal integration between features and classifiers has a significant effect on the performance of automatic heartbeat diagnostic systems. This importance stands out when dealing with critical applications that contain limited resources devices and require accurate and fast heartbeat classifiers to help the doctor make an accurate and quick diagnosis of heart diseases. Aiming at this task, this paper introduces a novel approach for choosing the optimal features of the ECG signal to be used with the Random Forest (RF) classifier following the inter-patient method for ECG signals division and obeying the instructions of the "Association for the Advancement of Medical Instrumentation (AAMI)." The features were chosen based on the concept of "Mutual Information Ranking (MIR)." The presented framework is comprehensive in terms of performing all the necessary processes efficiently, starting from ECG digital signal processing, segmentation, feature extraction, feature selection, and ending with ECG classification. The results of the experiments demonstrate that features corresponding to the normalized QRS width and the normalized RR intervals are the most influential features in the heartbeat classification. All tests were conducted using real ECG signals taken from the "MIT-BIH" Arrhythmia Database (MIT-BIH-ARR-DB). The suggested scheme attained the following F1-scores: 91.02%, 73.17%, and 98.04% in the classification of the Ventricular Ectopic Beats (V or VEB), Supraventricular Ectopic Beats (S or SVEB), and Normal Beats (N or NB), respectively. The overall accuracy was 96.26%. Despite its relative simplicity and reliance on few features, the proposed approach outperforms most of the reported state-of-the-art.